na_nocb: Next observation carry back

Description Usage Arguments Value See Also Examples

Description

Fill missing values in a time series (or in a column of a longitudional data set) with the next observation carry back method.

Usage

1

Arguments

indicator

A tibble created by get_eurostat_indicator. with time, geo, value, frequency, estimate and method columns.

Value

A tibble updated with the values carried back.

See Also

Other approximation functions: impute_indicators(), na_approx(), na_locf()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
example_df <- data.frame (
   time = rep(as.Date (paste0(2018:2021, "-01-01")),3),
   geo = c( rep("NL", 4), rep("BE", 4), rep("LU", 4)),
   value = c(10,11, NA_real_, 12, NA_real_, 21,22,23, 5,6,7,NA_real_),
   frequency = rep("A", 12)
)
example_df$method <- ifelse(is.na(example_df$value), "missing", "actual")
example_df$estimate <- example_df$method

na_nocb ( example_df )
}

dataobservatory-eu/indicator documentation built on Dec. 19, 2021, 8:13 p.m.