translate: Translate columns from code to names in data.frame

View source: R/translate.R

translateR Documentation

Translate columns from code to names in data.frame

Description

Translate columns from code to names in data.frame

Usage

translate(.tbl, .var, trans_vec, simple = FALSE, ...)

Arguments

.tbl

A tbl object.

.var

A unquoted column name to translate.

trans_vec

A named tranlation vector. Codes as names.

simple

if TRUE simplyfied by simple_lab. By default only first part of the name is taken, split by ",".

...

further arguments to simple_lab.

Examples

  tbl <- tibble::tibble(geo = c("FI", "SE"))
  t_geo <- c(FI = "Suomi", SE = "Ruotsi")
  translate(tbl, geo, t_geo)
  translate(tibble::tibble(vars = c("nulc", "nulc_va", "nulc_hw", "nulc_hw_va", "nulc_aper", "nulc_aper_va")),
            vars, var_labels_fi, simple = TRUE, parts = c(3, 4))


pttry/ficomp documentation built on June 11, 2024, 9:53 p.m.