Skip to contents

Municipality groups are a convenient way to discover pre-rendered sets of municipalities. A practical workflow for discovering such sets can be to search through Municipality Group metadata using municipality_grp_search() to search for keywords and municipality_grp_describe() to inspect contents of KPI groups. Once you have created a Municipality Group metadata table that has been narrowed down to the group/s you are looking for, municipality_grp_unnest() is used to create a municipality metadata table for further processing.

Usage

municipality_grp_unnest(munic_grp_df)

Arguments

munic_grp_df

A Kolada Municipality Group metadata table, as created by e.g. get_municipality_groups.

Value

A Kolada Municipality metadata table

Examples

if (kolada_available()) {
# Download Municipality Group metadata
# (skip the parameter "max_results" to actually download all available data)
munic_grp_df <- get_municipality_groups(max_results = 100)

# Create a Municipality metadata table from municipality groups matching the
# term "Arboga"
munic_grp_df |>
  municipality_grp_search("arboga") |>
  municipality_grp_unnest()
}
#> # A tibble: 7 × 4
#>   id    title      group_id group_title                                 
#>   <chr> <chr>      <chr>    <chr>                                       
#> 1 0319  Älvkarleby G176199  Liknande kommuner socioekonomi, Arboga, 2024
#> 2 0562  Finspång   G176199  Liknande kommuner socioekonomi, Arboga, 2024
#> 3 0687  Tranås     G176199  Liknande kommuner socioekonomi, Arboga, 2024
#> 4 1082  Karlshamn  G176199  Liknande kommuner socioekonomi, Arboga, 2024
#> 5 1083  Sölvesborg G176199  Liknande kommuner socioekonomi, Arboga, 2024
#> 6 1885  Lindesberg G176199  Liknande kommuner socioekonomi, Arboga, 2024
#> 7 2084  Avesta     G176199  Liknande kommuner socioekonomi, Arboga, 2024