fill_table: Find non-reported dates and fill them with 'NA_real_'

Description Usage Arguments Value Examples

View source: R/ff_fill_table.R

Description

Automatically finds non recorded date periods and fills them with NA_real_ values.

Usage

1
fill_table(x, col_name = "all", by = NULL)

Arguments

x

data frame with class Date or POSIXct in the first column.

col_name

string with column(s) name(s) to fill.

by

string with a valid time step (e.g.: 'month', 'day', '6 hour', '3 hour', '1 hour', '15 min' ).

Value

A data frame with the date and the filled numeric variable(s).

Examples

1
2
3
4
5
6
7
8
# let's use a synthetic example to illustrate the use of the function
dates <- seq.Date(from = as.Date('1980-01-01'),
                 to = as.Date('2020-01-01'), by = 'day' )
var   <- runif(n = length(dates), min = 0, max = 100)

met_var <- data.frame(date = dates, random = var)[-c(50:100, 251, 38) , ]

met_var_fill <- fill_table(x = met_var, by = 'day')

hydrotoolbox documentation built on July 9, 2021, 1:06 a.m.