powered by
Replaces all values in x which match old with values in new. Values are matched with base::match().
x
old
new
base::match()
map_values(x, old, new)
(vector()) of the same length as x.
vector()
(vector()).
vector())
(vector()) Vector with values to replace.
(vector()) Values to replace with. Will be forced to the same length as old with base::rep_len().
base::rep_len()
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)
Run the code above in your browser using DataLab