SwissStatsR / noga

R Package to recode noga values and labels
GNU General Public License v3.0
0 stars 2 forks source link

noga

R-CMD-check

The noga package allows recoding noga values to their labels or vice versa. Noga is derived from the European classification system of economic activities (NACE). NOGA08 is the version currently supported in this package.

Installation

You can install the noga package from GitHub with:

# install.packages("devtools")
devtools::install_github("swissstatsr/noga")

The package is not yet available on CRAN.

NOGA-levels

The Noga classification system has 5 levels which can be recoded with this package:

Note that if you recode labels to values, the output variable will be in string format as the noga codes are essentially strings rather than a numeric.

Usage

The function noga::noga_recode() recodes noga values to their labels or vice versa. Please note that the vector/variable you recode cannot contain multiple noga levels simultaneously. The function will not be able to recode a vector that contains both the noga-group and noga-class level. If all given labels are shared across several levels, the deepest (most specific) level will be used.

library(noga)

example.data <- data.frame(
  test1 = c(702, 62),
  test2 = c("Management consultancy activities", "Extraction of natural gas"),
  test3 = c("702", "062")
)

noga_recode(var=example.data$test1, language = "fr", level = "group", to = "auto")
#> [1] "Conseil de gestion"        "Extraction de gaz naturel"
noga_recode(var=example.data$test2, language = "en", level = "auto", to = "values")
#> [1] "702" "062"
noga_recode(var=example.data$test3, language = "de", level = "auto", to = "auto")
#> [1] "Public-Relations- und Unternehmensberatung"
#> [2] "Gewinnung von Erdgas"

Planned expansion for the future