Package 'noga'

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

Help Index


NOGA lookup table

Description

This data.frame contains all the NOGA codes and labels at various levels. The labels are available in english, german, french and italian.

Usage

lookup

Format

## 'lookup' A data frame with 1,790 rows and 10 columns:

code

NOGA code

section

section code

division

division code (2-digit)

group

group code (3-digit)

class

class code (4-digit)

type

type code (full 6-digit)

name_en

English label

name_de

German label

name_fr

French label

name_it

Italian label

Source

<https://www.i14y.admin.ch/it/catalog/datasets/HCL_NOGA/api>


NOGA code table

Description

This tibble contains all the NOGA codes and labels at various levels. The labels are available in english, german, french and italian.

Usage

noga_levels

Format

## 'noga_levels' A tibble with 1,790 rows and 15 columns:

section

section code

division

division code (2-digit)

group

group code (3-digit)

class

class code (4-digit)

type

type code (full 6-digit)

code

NOGA code

name_en

English label

name_de

German label

name_fr

French label

name_it

Italian label

division.n

division code, numeric version

group.n

group code, numeric version

class.n

class code, numeric version

type.n

type code, numeric version

code.n

code, numeric version

Source

<https://www.i14y.admin.ch/it/catalog/datasets/HCL_NOGA/api>


NOGA code table

Description

This tibble contains all the NOGA codes and labels at various levels. The labels are available in english, german, french and italian.

Usage

noga_levels_agg

Format

## 'noga_levels_agg' A tibble with 1,790 rows and 19 columns:

section

section code

division

division code (2-digit)

group

group code (3-digit)

class

class code (4-digit)

type

type code (full 6-digit)

code

NOGA code

name_de

German label

Section

section code, only for sections

Division

division code, only for divisions

Group

group code, only for groups

Class

class code, only for classes

Type

type code, only for types

name_en

English label

name_fr

French label

name_it

Italian label

division.n

division code, numeric version

group.n

group code, numeric version

class.n

class code, numeric version

type.n

type code, numeric version

Source

<https://www.i14y.admin.ch/it/catalog/datasets/HCL_NOGA/api>


Function to recode a variable containing noga codes to labels and vice versa

Description

Function to recode a variable containing noga codes to labels and vice versa

Usage

noga_recode(var, language = "en", level = "auto", to = "auto", warn = TRUE)

Arguments

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.

Value

a recoded variable in string format (either noga-labels, or noga-codes).

Examples

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")