powered by
This function replaces character values with new character values, which is useful when performing rename operations when values are held in character vectors.
rename.values(x, ..., defaultValue = x, warn_missing = TRUE)
Vector of values to replace
Key/value pairs in the form oldvalue="newvalue"
oldvalue="newvalue"
A vector of values to use as the default should the value not be found in ...
...
Print a message if any old names are not actually present in x
A vector with values replaced
# NOT RUN { x <- c("fish", "fish", "fish", "whistle") rename.values(x, fish="newfish") rename.values(x, whistle="newwhistle") rename.values(x, fish="newfish", defaultValue="not a fish") # }
Run the code above in your browser using DataLab