Simplify a Kolada values table, i.e as created by get_values
,
by removing columns that contain monotonous data, i.e. that contain only one
value for all observations.
values_minimize(values_df)
A Kolada value table, as created by
get_values
.
A Kolada values table
# Download values for all available years of a given KPI for
# Malmö municipality (code 1280)
vals <- get_values(kpi = "N45933", municipality = "1280", simplify = TRUE)
# (Returns a table with 5 rows and 8 columns)
# Remove columns with no information to differentiate between rows
values_minimize(vals)
#> # A tibble: 5 × 4
#> kpi year value municipality
#> <chr> <int> <dbl> <chr>
#> 1 N45933 2016 24.8 Malmö
#> 2 N45933 2017 26.7 Malmö
#> 3 N45933 2018 38.0 Malmö
#> 4 N45933 2019 35.6 Malmö
#> 5 N45933 2020 30.3 Malmö
# (Returns a table with 5 rows and 4 columns)