replaceEntries | R Documentation |
Replace entries according to a mapping list
replaceEntries(x, map, ...)
## S4 method for signature 'vector,list'
replaceEntries(x, map, ...)
x |
An R vector |
map |
A named list representing one-to-one or one-to-many mappings. Normally, each name represents a new value, and each element contain the old value(s) to be replaced. |
... |
Arguments passed to other methods. |
A updated x
set.seed(1234)
fact <- factor(c("A", "A", "B", "A", "B", "C", "D", "E", "D"))
map <- list("a" = c("B", "e")) ## Turn all "B" and "E" into "a"
replaceEntries(fact, map)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.