Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get.label

Get Stata Label Table for a Label Set


Description

Retrieve the value labels for a specific Stata label set.

Usage

get.label(dat, label.name)

Arguments

dat

data.frame. Data.frame created by read.dta13.

label.name

character. Name of the Stata label set

Details

This function returns the table of factor levels which represent a Stata label set. The name of a label set for a variable can be obtained by get.label.name.

Value

Returns a named vector of code numbers

Author(s)

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

Examples

dat <- read.dta13(system.file("extdata/statacar.dta", package="readstata13"))
labname <- get.label.name(dat,"type")
get.label(dat, labname)

readstata13

Import 'Stata' Data Files

v0.10.0
GPL-2 | file LICENSE
Authors
Jan Marvin Garbuszus [aut], Sebastian Jeworutzki [aut, cre] (<https://orcid.org/0000-0002-2671-5253>), R Core Team [cph], Magnus Thor Torfason [ctb], Luke M. Olson [ctb], Giovanni Righi [ctb], Kevin Jin [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.