Title: | Structural Data for Norway |
---|---|
Description: | Datasets relating to population in municipalities, municipality/county matching, and how different municipalities have merged/redistricted over time from 2006 to 2024. |
Authors: | Richard Aubrey White [aut, cre]
|
Maintainer: | Richard Aubrey White <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2024.4.26 |
Built: | 2025-01-24 05:13:51 UTC |
Source: | https://github.com/csids/csdata |
Adds granularity_geo to a given data set
add_granularity_geo_to_data_set(x, location_reference = NULL)
add_granularity_geo_to_data_set(x, location_reference = NULL)
x |
A data.table containing a column called "location_code". |
location_reference |
A location reference data.table. |
A data.table containing an extra column called "granularity_geo".
library(data.table) data <- data.table(location_code = c("norge", "county03", "blah")) csdata::add_granularity_geo_to_data_set(data) print(data) library(data.table) data <- data.table(location_code = c("norge", "county03", "blah")) csdata::add_granularity_geo_to_data_set(data, location_reference = csdata::nor_locations_names()) print(data)
library(data.table) data <- data.table(location_code = c("norge", "county03", "blah")) csdata::add_granularity_geo_to_data_set(data) print(data) library(data.table) data <- data.table(location_code = c("norge", "county03", "blah")) csdata::add_granularity_geo_to_data_set(data, location_reference = csdata::nor_locations_names()) print(data)
Adds iso3 to a given data set
add_iso3_to_data_set(x)
add_iso3_to_data_set(x)
x |
A data.table containing a column called "location_code". |
A data.table containing an extra column called "iso3".
library(data.table) data <- data.table(location_code = c("norge", "county03", "blah")) csdata::add_iso3_to_data_set(data) print(data)
library(data.table) data <- data.table(location_code = c("norge", "county03", "blah")) csdata::add_iso3_to_data_set(data) print(data)
Available configuration variables:
border_nor (default 2024): The year in which Norwegian geographical boundaries were designated. Valid values: 2020, 2024.
config
config
An object of class environment
of length 1.
print(ls(csdata::config)) for(i in names(csdata::config)){ cat(i, ":", csdata::config[[i]], "\n") }
print(ls(csdata::config)) for(i in names(csdata::config)){ cat(i, ":", csdata::config[[i]], "\n") }
Convert location_code to granularity_geo
location_code_to_granularity_geo(x, location_reference = NULL)
location_code_to_granularity_geo(x, location_reference = NULL)
x |
Either a vector, or a data.frame/data.table containing a column called "location_code". |
location_reference |
A location reference data.table. |
Character vector the same length as x, containing the corresponding granularity_geo.
csdata::location_code_to_granularity_geo(c("nation_nor", "county_nor03"))
csdata::location_code_to_granularity_geo(c("nation_nor", "county_nor03"))
Convert location_code to iso3
location_code_to_iso3(x)
location_code_to_iso3(x)
x |
Either a vector, or a data.frame/data.table containing a column called "location_code". |
Character vector the same length as x, containing the corresponding iso3.
csdata::location_code_to_iso3(c("nation_nor", "county_nor03"))
csdata::location_code_to_iso3(c("nation_nor", "county_nor03"))
Norwegian characters in unicode
nb
nb
An object of class list
of length 6.
print(csdata::nb)
print(csdata::nb)
Calculates the relationship between different locations in Norway, according to geographic granularity. For example, which municipalities are inside which counties.
nor_locations_hierarchy_from_to( from, to, include_to_name = FALSE, border = csdata::config$border_nor )
nor_locations_hierarchy_from_to( from, to, include_to_name = FALSE, border = csdata::config$border_nor )
from |
wardoslo, wardbergen, wardtrondheim, wardstavanger, municip, baregion, county, georegion, mtregion, notmainlandmunicip, notmainlandcounty, missingmunicip, missingcounty |
to |
wardoslo, wardbergen, wardtrondheim, wardstavanger, municip, baregion, county, georegion, mtregion, notmainlandmunicip, notmainlandcounty, missingmunicip, missingcounty |
include_to_name |
Do you want to include the name of the 'to' location? |
border |
The year in which Norwegian geographical boundaries were designated (2020, 2024). |
Data.table containing the columns:
from_code
to_code
to_name (if include_to_name==TRUE)
csdata::nor_locations_hierarchy_from_to(from="wardoslo", to="county") csdata::nor_locations_hierarchy_from_to(from="municip", to="baregion")
csdata::nor_locations_hierarchy_from_to(from="wardoslo", to="county") csdata::nor_locations_hierarchy_from_to(from="municip", to="baregion")
All names in Norway
nor_locations_names(border = csdata::config$border_nor)
nor_locations_names(border = csdata::config$border_nor)
border |
The year in which Norwegian geographical boundaries were designated (2020, 2024). |
Location code.
Location name.
3 letter location name for nation and county. A shorter location name for wardoslo and extrawardoslo.
Location name with additional description.
Location name that should be used in file names, with Norwegian characters.
Location name that should be used in file names, without Norwegian characters.
The preferred presentation order.
nation, county, municip, wardoslo, wardbergen, wardstavanger, wardtrondheim, baregion, lab.
https://no.wikipedia.org/wiki/Liste_over_norske_kommunenummer
nor_locations_names()
nor_locations_names()
This function returns a dataset that is used to transfer "original" datasets to the 2020 or 2024 borders.
nor_locations_redistricting(border = csdata::config$border_nor)
nor_locations_redistricting(border = csdata::config$border_nor)
border |
The year in which Norwegian geographical boundaries were designated (2020, 2024). |
The location code per today.
The location code as of "calyear".
The year corresponding to "county_code_original".
The weighting that needs to be applied.
nation, county, municip, wardbergen, wardoslo, wardstavanger, wardtrondheim, missingwardbergen, missingwardoslo, missingwardstavanger, missingwardtrondheim, notmainlandcounty, notmainlandmunicip, missingcounty
csdata::nor_locations_redistricting()
csdata::nor_locations_redistricting()
A function that easily categorizes the Norwegian population into different age categories.
nor_population_by_age_cats( cats = NULL, include_total = TRUE, include_9999 = FALSE, border = csdata::config$border_nor )
nor_population_by_age_cats( cats = NULL, include_total = TRUE, include_9999 = FALSE, border = csdata::config$border_nor )
cats |
A list containing vectors that you want to categorize. |
include_total |
Boolean. Should 'total' be included as an age cat? |
include_9999 |
Boolean. Should the current year is duplicated and added as "calyear==9999". This is in accordance with the cstidy principles regarding granularity_time=="event_*". |
border |
The year in which Norwegian geographical boundaries were designated (2020, 2024). |
A data.table containing the following columns:
granularity_geo
location_code
age (as specified in the argument "cats")
sex ("total")
calyear
pop_jan1_n
imputed
## Not run: nor_population_by_age_cats(cats = list(c(1:10), c(11:20))) ## End(Not run)
## Not run: nor_population_by_age_cats(cats = list(c(1:10), c(11:20))) ## End(Not run)
Swedish characters in unicode
se
se
An object of class list
of length 4.
print(csdata::se)
print(csdata::se)
Set options in the package config
set_config(border_nor = NULL)
set_config(border_nor = NULL)
border_nor |
The year in which Norwegian geographical boundaries were designated. Valid values: 2020, 2024. |
Nothing. Side effect of setting the config
environment.