Replace specified values with new values, in a vector or factor. This is copied from plyr.
mapvalues(x, from, to, warn_missing = TRUE)
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 |
Returns a vector with new values.
#' 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.
# NOT RUN { # }