map_values

0th

Percentile

Replace Elements of Vectors with New Values

Replaces all values in x which match old with values in new. Values are matched with base::match().

Usage
map_values(x, old, new)
Arguments
x

:: vector().

old

:: vector() Vector with values to replace.

new

:: vector() Values to replace with. Will be forced to the same length as old with base::rep_len().

Value

(vector()) of the same length as x.

Aliases
  • map_values
Examples
# NOT RUN {
x = letters[1:5]

# replace all "b" with "_b_", and all "c" with "_c_"
old = c("b", "c")
new = c("_b_", "_c_")
map_values(x, old, new)
# }
Documentation reproduced from package mlr3misc, version 0.1.0, License: LGPL-3

Community examples

Looks like there are no examples yet.