knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(statficlassifications)
library(dplyr)

There are two types of classification objects of interest: keys and classifications. Keys, or conversion keys or correspondence tables, are used to convert between different classifications and classifications can be used to convert names to codes and vice versa.

Searching for Keys

To list all available classification keys (correspondence tables), use search_keys() without arguments:

head(search_keys())

Plug in search terms to search for available keys:

search_keys("maakunta")
search_keys("kunta", "suuralue", 2020)

Getting Keys

The open classifications API uniquely identifies each classification key by a local ID. Having found the suitable key, you can use search_keys() with an argument as_localId = TRUE to print the localId of the key:

localId <- search_keys(source = "kunta", target = "suuralue", year = 2020, as_localId = TRUE)
localId

Then you can get the key by:

key <- get_key(localId)
head(key)

Searching for Classifications

To list all available classifications, use search_classifications() without arguments:

head(search_classifications())

Plug in search terms to search for available classifications:

search_classifications("ammatti")
search_classifications("ammatti", 2021)

Getting Classifications

To print the localId of the desired classification, use as_localId = TRUE.

localId <- search_classifications("ammatti", year = 2021, as_localId = TRUE)

Use localId to get the classification

head(get_classification(localId))


pttry/statficlassifications documentation built on Jan. 17, 2024, 4:36 p.m.