mapValues | R Documentation |
Map values from One Vector to Another
mapValues(data, oldValue, newValue)
data |
a vector of strings where values will be replaced |
oldValue |
a vector that matches values in the data vector |
newValue |
a vector of new values that will replace the old values |
return the vector with the mapped values. If there was no corresponding entry then replace it with an NA.
data <- c("A", "B", "C", "X", "Y", "Z") oldValue <- LETTERS[1:20] newValue <- letters[1:20] results <- mapValues(data, oldValue, newValue)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.