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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
\name{labels}
\alias{labels}
\alias{labels,NULL-method}
\alias{labels,item-method}
\alias{labels<-}
\alias{labels<-,item,ANY-method}
\alias{labels<-,ANY,NULL-method}
\alias{labels<-,item,NULL-method}
\alias{labels<-,vector,ANY-method}
\alias{labels<-,vector,NULL-method}
\alias{value.labels-class}
\alias{initialize,value.labels-method}
\alias{Arith,value.labels,ANY-method}
\alias{[,value.labels,numeric,missing,missing-method}
\alias{[,value.labels,logical,missing,missing-method}
\alias{coerce,numeric,value.labels-method}
\alias{coerce,character,value.labels-method}
\alias{coerce,value.labels,numeric-method}
\alias{coerce,value.labels,character-method}
\alias{as.vector,value.labels-method}
\alias{show,value.labels-method}
\title{Value Labels}
\description{
Value labels associate character labels to possible values
of an encoded survey item. Value labels are represented
as objects of class "value.labels".
Value labels of an item can be obtained
using \code{labels(x)} and
can be associated to items and to vectors
using labels(x) <- value
Value labels also can be updated using the \code{+}
and \code{-} operators.
}
\usage{
labels(object,\dots)
labels(x) <- value
}
\arguments{
\item{object}{any object.}
\item{\dots}{further arguments for other methods.}
\item{x}{a vector or "item" object.}
\item{value}{an object of class "value.labels" or
a vector that can be coerced into an "value.labels" object or NULL}
}
\examples{
x <- as.item(rep(1:5,4),
labels=c(
"First" = 1,
"Second" = 2,
"Third" = 3,
"Fourth" = 4,
"Don't know" = 5
),
missing.values=5,
annotation = c(
description="test"
))
labels(x)
labels(x) <- labels(x) - c("Second"=2)
labels(x)
labels(x) <- labels(x) + c("Second"=2)
labels(x)
puvl <- getOption("print.use.value.labels")
options(print.use.value.labels=FALSE)
x
options(print.use.value.labels=TRUE)
x
options(print.use.value.labels=puvl)
}
|