Skip to contents

Given a vector of municipality IDs/codes, return a named vector of names of municipalities or regions. Codes of municipalities and regions follow the Swedish standard for municipality codes. The codes extracted can be used e.g. to pass as a parameter to get_values. This function is the inverse to municipality_name_to_id.

Usage

municipality_id_to_name(munic_df, id, remove_na = FALSE)

Arguments

munic_df

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

id

ID ids of one or several municipalities. Allows repeats.

remove_na

Should NA return values be removed?

Value

A vector of Municipality names.

Examples

if (kolada_available()) {
munic_df <- get_municipality()
municipality_id_to_name(munic_df, c("1280", "1281", "0180", "1280"))
}
#>        1280        1281        0180        1280 
#>     "Malmö"      "Lund" "Stockholm"     "Malmö"