complete_dateseq: Fill up missing dates with NA values

Description Usage Arguments Examples

View source: R/utilities.R

Description

This function allows you to generate a dataframe with a complete datesequence by filling up missing dates with rows filled with NAs

Usage

1
2
3
4
5
6
7
8
complete_dateseq(
  df,
  timestep = NULL,
  sample.size = 0.5,
  datecol.name = NULL,
  unit = "year",
  verbose = F
)

Arguments

df

data.frame, a column of format Date or POSIXct has to be present

timestep

integer, number of seconds between each row in the data.frame. Optional, if not supplied this number is guessed which may take some time for large data.frames

datecol.name

string, optional name of the datecolumn, otherwise it will be detected automatically using rebecka::detect_datecol

unit

string, one of 'year' or 'day', start timestamp will be rounded down and end timestamp up to this unit and the sequence will then be filled from start to end

verbose

logical, if TRUE and timestep is not given the detected time resolution will be printed

Examples

1
complete_dateseq(df, format = 'Date', group.cols = 'st_id', unit = 'year')

sitscholl/rebecka_package documentation built on Aug. 25, 2020, 4:20 a.m.