R: Assign Stata Language Labels

set.lang {readstata13} | R Documentation

## Assign Stata Language Labels

### Description

Changes default label language for a dataset. Variables with generated labels (option generate.labels=TRUE) are kept unchanged.

### Usage

    set.lang(dat, lang = NA, generate.factors = FALSE)

### Arguments

`dat` | data.frame. Data.frame created by `read.dta13`.
`lang` | character. Label language. Default language defined by `get.lang` is used if NA
`generate.factors` | logical. If `TRUE`, missing factor levels are generated.

### Value

Returns a data.frame with value labels in language "lang".

### Author(s)

Jan Marvin Garbuszus jan.garbuszus@ruhr-uni-bochum.de

Sebastian Jeworutzki sebastian.jeworutzki@ruhr-uni-bochum.de

### Examples

    dat <- read.dta13(system.file("extdata/statacar.dta", package="readstata13"))
    get.lang(dat)
    varlabel(dat)

    # set German label
    datDE <- set.lang(dat, "de")
    get.lang(datDE)
    varlabel(datDE)

[Package readstata13 version 0.9.2 Index]