labels

0th

Percentile

Value Labels

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 labels(x) and can be associated to items and to vectors using labels(x) <- value

Value labels also can be updated using the + and - operators.

Usage
labels(object,…)
labels(x) <- value
Arguments
object

any object.

further arguments for other methods.

x

a vector or "item" object.

value

an object of class "value.labels" or a vector that can be coerced into an "value.labels" object or NULL

Aliases
  • labels
  • labels,NULL-method
  • labels,item-method
  • labels<-
  • labels<-,item,ANY-method
  • labels<-,ANY,NULL-method
  • labels<-,item,NULL-method
  • labels<-,vector,ANY-method
  • value.labels-class
  • initialize,value.labels-method
  • Arith,value.labels,ANY-method
  • [,value.labels,numeric,missing,missing-method
  • [,value.labels,logical,missing,missing-method
  • coerce,numeric,value.labels-method
  • coerce,character,value.labels-method
  • coerce,value.labels,numeric-method
  • coerce,value.labels,character-method
  • as.vector,value.labels-method
  • show,value.labels-method
Examples
# NOT RUN {
  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)
# }
Documentation reproduced from package memisc, version 0.99.27.3, License: GPL-2

Community examples

Looks like there are no examples yet.