translate | R Documentation |
Replaces a set of values in a vector with another set of values, so it translates your vector. Oldvalues and newvalues have to be 1-to-1 corresponding vectors. 'chartr("a-cX", "D-Fw", x) does the same as above in theory, but it did not seem very robust regarding your input...'
translate(vec, old, new)
vec |
set of values where you want to replace |
old |
oldvalues, a vector of values that occur in |
new |
newvalues, a vector of equal length, to be copied from, corresponding 1-by-1 to old. |
A <- 1:3
translate(vec = A, old = 2:3, new = letters[1:2])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.