add_iso3_to_data_set: Add an iso3 column to a data set

View source: R/add_variable_to_data_set.R

add_iso3_to_data_setR Documentation

Add an iso3 column to a data set

Description

Derives the ISO 3166-1 alpha-3 country code from the location_code column and adds it as a new column, modifying x in place. Currently all Norwegian location codes map to "nor".

Usage

add_iso3_to_data_set(x)

Arguments

x

A data.table containing a column named location_code.

Value

x, invisibly, with a new granularity_geo column containing the ISO 3166-1 alpha-3 country code (always "nor" for Norwegian locations).

Examples

library(data.table)
data <- data.table(location_code = c("nation_nor", "county_nor03", "blah"))
csdata::add_iso3_to_data_set(data)
print(data)

csdata documentation built on July 3, 2026, 1:07 a.m.