Replace specified values with new values, in a vector or factor. This is copied from plyr.

mapvalues(x, from, to, warn_missing = TRUE)

Arguments

x

the factor or vector to modify

from

a vector of the items to replace

to

a vector of replacement values

warn_missing

print a message if any of the old values are not actually present in x

Value

Returns a vector with new values.

Details

#' If x is a factor, the matching levels of the factor will be replaced with the new values.

The related revalue function works only on character vectors and factors, but this function works on vectors of any type and factors.

Examples

# NOT RUN {
# }