mapvalues: mapvalues

mapvaluesR Documentation

mapvalues

Description

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

Usage

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

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.

Value

Returns a vector with new values.


OHI-Science/ohicore documentation built on Dec. 10, 2023, 5:45 a.m.