| 1 |
\name{labels} |
| 2 |
\alias{labels} |
| 3 |
\alias{labels,NULL-method} |
| 4 |
\alias{labels,item-method} |
| 5 |
\alias{labels<-} |
| 6 |
\alias{labels<-,item,ANY-method} |
| 7 |
\alias{labels<-,ANY,NULL-method} |
| 8 |
\alias{labels<-,item,NULL-method} |
| 9 |
\alias{labels<-,vector,ANY-method} |
| 10 |
\alias{labels<-,vector,NULL-method} |
| 11 |
\alias{value.labels-class} |
| 12 |
\alias{initialize,value.labels-method} |
| 13 |
\alias{Arith,value.labels,ANY-method} |
| 14 |
\alias{[,value.labels,numeric,missing,missing-method} |
| 15 |
\alias{[,value.labels,logical,missing,missing-method} |
| 16 |
\alias{coerce,numeric,value.labels-method} |
| 17 |
\alias{coerce,character,value.labels-method} |
| 18 |
\alias{coerce,value.labels,numeric-method} |
| 19 |
\alias{coerce,value.labels,character-method} |
| 20 |
\alias{as.vector,value.labels-method} |
| 21 |
\alias{show,value.labels-method} |
| 22 |
\title{Value Labels} |
| 23 |
\description{ |
| 24 |
Value labels associate character labels to possible values |
| 25 |
of an encoded survey item. Value labels are represented |
| 26 |
as objects of class "value.labels". |
| 27 |
|
| 28 |
Value labels of an item can be obtained |
| 29 |
using \code{labels(x)} and |
| 30 |
can be associated to items and to vectors |
| 31 |
using labels(x) <- value |
| 32 |
|
| 33 |
Value labels also can be updated using the \code{+} |
| 34 |
and \code{-} operators. |
| 35 |
} |
| 36 |
\usage{ |
| 37 |
labels(object,\dots) |
| 38 |
labels(x) <- value |
| 39 |
} |
| 40 |
\arguments{ |
| 41 |
\item{object}{any object.} |
| 42 |
\item{\dots}{further arguments for other methods.} |
| 43 |
\item{x}{a vector or "item" object.} |
| 44 |
\item{value}{an object of class "value.labels" or |
| 45 |
a vector that can be coerced into an "value.labels" object or NULL} |
| 46 |
} |
| 47 |
\examples{ |
| 48 |
x <- as.item(rep(1:5,4), |
| 49 |
labels=c( |
| 50 |
"First" = 1, |
| 51 |
"Second" = 2, |
| 52 |
"Third" = 3, |
| 53 |
"Fourth" = 4, |
| 54 |
"Don't know" = 5 |
| 55 |
), |
| 56 |
missing.values=5, |
| 57 |
annotation = c( |
| 58 |
description="test" |
| 59 |
)) |
| 60 |
labels(x) |
| 61 |
labels(x) <- labels(x) - c("Second"=2) |
| 62 |
labels(x) |
| 63 |
labels(x) <- labels(x) + c("Second"=2) |
| 64 |
labels(x) |
| 65 |
|
| 66 |
puvl <- getOption("print.use.value.labels") |
| 67 |
options(print.use.value.labels=FALSE) |
| 68 |
x |
| 69 |
options(print.use.value.labels=TRUE) |
| 70 |
x |
| 71 |
options(print.use.value.labels=puvl) |
| 72 |
} |