factor2char | R Documentation |
These two functions are an illustration of how as.character
and
as.factor
may be reimplemented at the C++ level.
factor2char(iv)
char2factor(sv)
iv |
A Integer Vector corresponding to numeric representation of the factor This vector is also expected to have an attribute ‘levels’ with the factor levels |
sv |
A String Vector |
A Character Vector which at each position contains the level value of the corresponding index, or a Factor, depending on the function
f <- as.factor(c("red", "green", "blue", "red"))
factor2char(f);
f <- as.factor(c("red", "green", "blue", "red"))
v <- factor2char(f);
char2factor(v)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.