powered by
mapValues(x, from, to, regex = FALSE, ignore.case = FALSE, perl = FALSE, fixed = FALSE)
atomic
x
to
from
logical
FALSE
gsub
# replace integers x = 1:5 mapValues(x, c(2, 3), c(99, 100)) # replace factor levels using regex matching x = factor(c("aab", "aba", "baa")) mapValues(x, "a.a", "zzz", regex = TRUE)
Run the code above in your browser using DataLab