Extract specific country and year data
filter_countries_years.Rd
Data is extracted according to the countries
and years
objects
in a way that is amenable to drake subtargets.
dplyr::filter()
does the subsetting.
Arguments
- .df
A data frame containing cleaned data with lots of countries and years.
- countries
A list of country codes for countries to be analyzed. "all" means return all countries.
- years
A vector of years. "all" means return all years.
- country, year
See
IEATools::iea_cols
.
Examples
IEATools::sample_iea_data_path() |>
IEATools::load_tidy_iea_df() |>
filter_countries_years(countries = c("ZAF"), years = 1960:1999)
#> # A tibble: 98 × 11
#> Country Method Energy.type Last.stage Year Ledger.side
#> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 ZAF PCM E Final 1971 Supply
#> 2 ZAF PCM E Final 1971 Supply
#> 3 ZAF PCM E Final 1971 Supply
#> 4 ZAF PCM E Final 1971 Supply
#> 5 ZAF PCM E Final 1971 Supply
#> 6 ZAF PCM E Final 1971 Supply
#> 7 ZAF PCM E Final 1971 Supply
#> 8 ZAF PCM E Final 1971 Supply
#> 9 ZAF PCM E Final 1971 Supply
#> 10 ZAF PCM E Final 1971 Supply
#> # ℹ 88 more rows
#> # ℹ 5 more variables: Flow.aggregation.point <chr>, Flow <chr>, Product <chr>,
#> # Unit <chr>, E.dot <dbl>