Completes a panel so every country has every year, optionally filling missing
values by carry-forward ("locf") or linear interpolation ("linear") so
animations do not flicker on missing years.
Usage
complete_years(
data,
years = NULL,
value = NULL,
method = c("none", "locf", "linear")
)Examples
df <- data.frame(iso3c = "USA", year = c(2000L, 2002L), gdp = c(1, 3))
complete_years(df, 2000:2002, method = "linear")
#> # A tibble: 3 × 3
#> iso3c year gdp
#> <chr> <int> <dbl>
#> 1 USA 2000 1
#> 2 USA 2001 2
#> 3 USA 2002 3
