File: varlabel.Rd

package info (click to toggle)
r-cran-readstata13 0.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 804 kB
  • sloc: cpp: 1,770; ansic: 278; makefile: 2
file content (53 lines) | stat: -rw-r--r-- 1,366 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tools.R
\name{varlabel}
\alias{varlabel}
\alias{'varlabel<-'}
\alias{varlabel<-}
\title{Get and assign Stata Variable Labels}
\usage{
varlabel(dat, var.name = NULL, lang = NA)

varlabel(dat) <- value
}
\arguments{
\item{dat}{\emph{data.frame.} Data.frame created by \code{read.dta13}.}

\item{var.name}{\emph{character vector.} Variable names. If NULL, get label
for all variables.}

\item{lang}{\emph{character.} Label language. Default language defined by
\code{\link{get.lang}} is used if NA}

\item{value}{\emph{character vector.} Character vector of size ncol(data) with variable names.}
}
\value{
Returns an named vector of variable labels
}
\description{
Retrieve or set variable labels for a dataset.
}
\examples{
dat <- read.dta13(system.file("extdata/statacar.dta", package="readstata13"),
                  convert.factors=FALSE)

# display variable labels 
varlabel(dat)

# display german variable labels
varlabel(dat, lang="de")

# display german variable label for brand
varlabel(dat, var.name = "brand", lang="de")

# define new variable labels
varlabel(dat) <- letters[1:ncol(dat)]

# display new variable labels
varlabel(dat)
}
\author{
Jan Marvin Garbuszus \email{jan.garbuszus@ruhr-uni-bochum.de}

Sebastian Jeworutzki \email{sebastian.jeworutzki@ruhr-uni-bochum.de}
}