Learn R Programming

eurostat (version 3.2.2)

label_eurostat: Get Eurostat Codes

Description

Get definitions for Eurostat codes from Eurostat dictionaries.

Usage

label_eurostat(x, dic = NULL, code = NULL, eu_order = FALSE,
  lang = "en", fix_duplicated = FALSE)

label_eurostat_vars(x, lang = "en")

label_eurostat_tables(x, lang = "en")

Arguments

x

A character or a factor vector or a data_frame.

dic

A string (vector) naming eurostat dictionary or dictionaries. If NULL (default) dictionry names taken from column names of the data_frame.

code

For data_frames names of the column for which also code columns should be retained. The suffix "_code" is added to code column names.

eu_order

Logical. Should Eurostat ordering used for label levels. Affects only factors.

lang

A character, code for language. Available are "en" (default), "fr" and "de".

fix_duplicated

A logical. If TRUE, the code is added to the duplicated label values. If FALSE (default) error is given if labelling produce duplicates.

Value

a vector or a data_frame.

Functions

  • label_eurostat_vars: Get definitions for variable (column) names. For objects other than characters or factors definitions are get for names.

  • label_eurostat_tables: Get definitions for table names

Details

A character or a factor vector of codes returns a corresponding vector of definitions. label_eurostat labels also data_frames from get_eurostat. For vectors a dictionary name have to be supplied. For data_frames dictonary names are taken from column names. "time" and "values" columns are returned as they were, so you can supply data_frame from get_eurostat and get data_frame with definitions instead of codes.

Some Eurostat dictionaries includes dublicated labels. By default dublicated labels cause an error, but they can be fixed automatically with fix_duplicated = TRUE.

Examples

Run this code
# NOT RUN {
 
# }
# NOT RUN {
   lp <- get_eurostat("nama_aux_lp")
   lpl <- label_eurostat(lp)
   str(lpl)
   lpl_order <- label_eurostat(lp, eu_order = TRUE)
   lpl_code <- label_eurostat(lp, code = "unit")
   label_eurostat_vars(names(lp))
   label_eurostat_tables("nama_aux_lp")
 
# }

Run the code above in your browser using DataLab