View source: R/recodev_function.R
recodev | R Documentation |
This function takes a vector original.vector, and converts all values in a vector old.values to the values in a new vector new.values.
recodev(original.vector, old.values, new.values, others = NULL)
original.vector |
A vector you want to recode |
old.values |
A vector of length M. |
new.values |
A vector of length M. |
others |
An optional value indicating what to convert all values in original.vector that are not found in old.values. |
x <- c("y", "y", "XSF", "y", "0", "X", "0", "0", "y", "n", "0", "1", "1")
recodev(
original.vector = x,
old.values = c("y", "1", "n", "0"),
new.values = c(1, 1, 0, 0)
)
x <- c("y", "y", "XSF", "y", "0", "X", "0", "0", "y", "n", "0", "1", "1")
recodev(
original.vector = x,
old.values = c("y", "1", "n", "0"),
new.values = c(1, 1, 0, 0),
others = NA
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.