map_values {mlr3misc} | R Documentation |
Replace Elements of Vectors with New Values
Description
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 |
( |
old |
( |
new |
( |
Value
(vector()
) of the same length as x
.
Examples
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)
[Package mlr3misc version 0.15.1 Index]