add_granularity_geo_to_data_set {csdata}R Documentation

Adds granularity_geo to a given data set

Description

Adds granularity_geo to a given data set

Usage

add_granularity_geo_to_data_set(x, location_reference = NULL)

Arguments

x

A data.table containing a column called "location_code".

location_reference

A location reference data.table.

Value

A data.table containing an extra column called "granularity_geo".

Examples

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)

[Package csdata version 2024.4.26 Index]