Title: | noga: Recode according to the General Classifcation of Economic Activities 2008 |
---|---|
Description: | This package recodes numeric NOGA values to its value labels and vice versa The package allows to recode values from all five NOGA levels (Section, Division, Group, Class and Type). The package can recode values to value labels in four languages (English, German, French and Italian). |
Authors: | Johannes Besch [aut, cre, cph] , Felix Luginbuhl [ctb] , Sandro Burri [ctb], Raphaƫl Bubloz [ctb] |
Maintainer: | Johannes Besch <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.4 |
Built: | 2024-11-04 19:53:15 UTC |
Source: | https://github.com/SwissStatsR/noga |
This data.frame contains all the NOGA codes and labels at various levels. The labels are available in english, german, french and italian.
lookup
lookup
## 'lookup' A data frame with 1,790 rows and 10 columns:
NOGA code
section code
division code (2-digit)
group code (3-digit)
class code (4-digit)
type code (full 6-digit)
English label
German label
French label
Italian label
<https://www.i14y.admin.ch/it/catalog/datasets/HCL_NOGA/api>
This tibble contains all the NOGA codes and labels at various levels. The labels are available in english, german, french and italian.
noga_levels
noga_levels
## 'noga_levels' A tibble with 1,790 rows and 15 columns:
section code
division code (2-digit)
group code (3-digit)
class code (4-digit)
type code (full 6-digit)
NOGA code
English label
German label
French label
Italian label
division code, numeric version
group code, numeric version
class code, numeric version
type code, numeric version
code, numeric version
<https://www.i14y.admin.ch/it/catalog/datasets/HCL_NOGA/api>
This tibble contains all the NOGA codes and labels at various levels. The labels are available in english, german, french and italian.
noga_levels_agg
noga_levels_agg
## 'noga_levels_agg' A tibble with 1,790 rows and 19 columns:
section code
division code (2-digit)
group code (3-digit)
class code (4-digit)
type code (full 6-digit)
NOGA code
German label
section code, only for sections
division code, only for divisions
group code, only for groups
class code, only for classes
type code, only for types
English label
French label
Italian label
division code, numeric version
group code, numeric version
class code, numeric version
type code, numeric version
<https://www.i14y.admin.ch/it/catalog/datasets/HCL_NOGA/api>
Function to recode a variable containing noga codes to labels and vice versa
noga_recode(var, language = "en", level = "auto", to = "auto", warn = TRUE)
noga_recode(var, language = "en", level = "auto", to = "auto", warn = TRUE)
var |
The variable containing the noga-codes or noga-values that you want to recode. Must be numeric or string, factor variables are not supported. Note that the function can handle only variables that contain one NOGA-level only. |
language |
One of "de" (German), "en" (English), "fr" (French) or "it" (Italian). Defaults to English. |
level |
The NOGA-Level you want to recode. Must be one of "auto" (Default), "section" (1. level), "division" (2. level), "group" (3.), "class" (4.) or "type" (5.). If set to "auto", the NOGA level will be identified based on the number of digits/characters of the maximum non-missing value of that variable. If all the labels belong to more than one level, the deepest one is always used. The variable you recode can only contain one NOGA-level. |
to |
Recode values to labels or vice versa? Defaults to "auto" (will identify based on the input variable the recoding direction), or "values" will recode labels to values or "labels" will recode values (codes in string format) to labels. |
warn |
TRUE (default) or FALSE. When TRUE will give warnings about non-matching recodings. |
a recoded variable in string format (either noga-labels, or noga-codes).
example.data <- data.frame( test1 = c(702,620), test2 = c("Management consultancy activities","Extraction of natural gas"), test3=c("0702","0620")) noga::noga_recode(var=example.data$test1,language="fr",level="group",to="auto") noga::noga_recode(var=example.data$test2,language="en",level="auto",to="values") noga::noga_recode(var=example.data$test3,language="de",level="auto",to="auto")
example.data <- data.frame( test1 = c(702,620), test2 = c("Management consultancy activities","Extraction of natural gas"), test3=c("0702","0620")) noga::noga_recode(var=example.data$test1,language="fr",level="group",to="auto") noga::noga_recode(var=example.data$test2,language="en",level="auto",to="values") noga::noga_recode(var=example.data$test3,language="de",level="auto",to="auto")