Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/EdwinTh/padr
Padding of missing records in time series
https://github.com/EdwinTh/padr
Last synced: 3 months ago
JSON representation
Padding of missing records in time series
- Host: GitHub
- URL: https://github.com/EdwinTh/padr
- Owner: EdwinTh
- License: other
- Created: 2016-08-22T10:10:38.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-14T08:50:52.000Z (almost 1 year ago)
- Last Synced: 2024-05-21T02:54:52.288Z (6 months ago)
- Language: R
- Homepage: https://edwinth.github.io/padr/
- Size: 7.8 MB
- Stars: 133
- Watchers: 3
- Forks: 12
- Open Issues: 7
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---# padr
[![Build Status](https://travis-ci.org/EdwinTh/padr.png?branch=master)](https://travis-ci.org/EdwinTh/padr)
[![codecov.io](https://codecov.io/github/EdwinTh/padr/coverage.svg?branch=master)](https://codecov.io/github/EdwinTh/padr?branch=master)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/padr)](https://CRAN.R-project.org/package=padr)
[![](http://cranlogs.r-pkg.org/badges/padr)](https://CRAN.R-project.org/package=padr)`padr` is an R package that assists with preparing time series data. It provides two main functions that will quickly get the data in the format you want. When data is observed on too low a level, `thicken` will add a column of a higher interval to the data frame, after which the user can apply the appropriate aggregation. When there are missing records for time points where observations were absent, `pad` will automatically insert these records. A number of `fill_` functions help to subsequently fill the missing values.
# Usage
```{r, message = FALSE}
library(padr)
library(tidyverse)
coffee <- data.frame(
time_stamp = as.POSIXct(c(
'2016-07-07 09:11:21', '2016-07-07 09:46:48',
'2016-07-09 13:25:17',
'2016-07-10 10:45:11'
)),
amount = c(3.14, 2.98, 4.11, 3.14)
)coffee %>%
thicken('day') %>%
dplyr::group_by(time_stamp_day) %>%
dplyr::summarise(day_amount = sum(amount)) %>%
pad() %>%
fill_by_value(day_amount, value = 0)
```# More information
See the the general introduction Vignette for more examples. The implementation details Vignette describes how `padr` handles different time zones and daylight savings time.