Learn R Programming

memisc (version 0.11-9)

relabel: Change Labels of factors or of any labeled object

Description

This function changes the labels of a factor of any object that has a names, labels, value.labels, or variable.labels attribute.

Usage

## S3 method for class 'default':
relabel(x,...)
## S3 method for class 'factor':
relabel(x,...)

Arguments

x
An object with a names, labels, value.labels, or variable.labels attribute
...
A sequence of named arguments, all of type character

Value

  • The object x with new labels defined by the ...arguments.

Details

This function changes the names or labels of x according to the remaining arguments. The argument names are the old names, the values are the new names.

Examples

Run this code
f <- as.factor(rep(letters[1:4],5))
  print(f)
  relabel(f,
    a="A",
    b="B",
    c="C",
    d="D"
    )

Run the code above in your browser using DataLab