• Stars
    star
    130
  • Rank 277,575 (Top 6 %)
  • Language
    R
  • License
    Other
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Padding of missing records in time series

padr

Build Status codecov.io CRAN_Status_Badge

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

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)
## # A tibble: 4 Γ— 2
##   time_stamp_day day_amount
##   <date>              <dbl>
## 1 2016-07-07           6.12
## 2 2016-07-08           0   
## 3 2016-07-09           4.11
## 4 2016-07-10           3.14

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.

More Repositories

1

ADSwR

"Agile Machine Learning with R - A workflow" is an opinionated take on how to do a data science project in R
HTML
56
star
2

dutchmasters

R package with colour palettes derived from famous paintings by 17th century Dutch masers πŸ–ΌοΈπŸŽ¨ πŸ‘¨β€πŸŽ¨πŸ‡³πŸ‡±!
R
28
star
3

paletti

Creating colour palettes from your own palette or list of palettes.
R
15
star
4

EdwinTh.github.io

Website for blogging build in Jekyll using the so-simple theme
HTML
14
star
5

thatssorandom

R package with functions as described in thats-so-random.com
R
12
star
6

Bayesian-stats

Intro to Bayesian stats in two three-hour sessions
R
4
star
7

ggoutlier

R package for outlier plots
R
3
star
8

satRday

Presentation "Exploring NSE and tidyeval", satRday Amsterdam, September 1st 2018 - https://www.youtube.com/watch?v=K-AFdjYunO8
HTML
3
star
9

recipe_for_recipes

Talk at eRum2018 Budapest and accompanying blog post
HTML
2
star
10

advent_of_code

Doing the puzzles of the Advent of code 2018 (https://adventofcode.com)
R
2
star
11

rareboost

Implementation of some rareboost algorithms in R
R
2
star
12

tidytools

dplyr wrappers for common queries
R
1
star
13

adv_r

(Finally) working my way through Hadley's Advanced R, notes and code
1
star
14

dplyrwrappers

Shortcut functions that use dplyr
R
1
star
15

mytools

An R package with analysis tools I want to have at my disposal at all times
R
1
star
16

spac

Scraping some spac data and maybe do some modelling
R
1
star
17

custom_ggplot

Function to create biplots with ggplot2
R
1
star
18

tutorial_mult_col

Various tutorials, courses and talks
HTML
1
star