add_region: Add regions to data

View source: R/recode_regions.R

add_regionR Documentation

Add regions to data

Description

Uses get_regionkey- and recode-functions to provide a fast and simple way to add regions to data. Very pipe-friendly.

Usage

add_region(data, ..., from = NULL, year = NULL, offline = TRUE)

Arguments

data

data.frame

...

character(s), the region(s) to add.

from

character, variable in the data that is used to add regions to the data. Defaults to NULL, in which case function tries to guess the variable in the data.

year

double, year of region classification.

offline

logical, whether works offline with package data. Defaults to TRUE.

Value

data.frame

Examples


    data <- get_regionkey() |> dplyr::select(kunta_name) |> dplyr::mutate(values = rnorm(dplyr::n()))
     data |> add_region("maakunta")



pttry/statficlassifications documentation built on Sept. 25, 2024, 9:30 a.m.