fill_table {hydrotoolbox} | R Documentation |
Find non-reported dates and fill them with NA_*
Description
Automatically finds non recorded date periods and fills
them with NA_real_
values.
Usage
fill_table(x, col_name = "all", by = NULL)
Arguments
x |
data frame (or tibble) with class |
col_name |
string with column(s) name(s) to fill. |
by |
string with a valid time step (e.g.: |
Value
A data frame (or tibble) with the date and the filled numeric variable(s).
Examples
# 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')
[Package hydrotoolbox version 1.1.2 Index]