reFactor | R Documentation |
This functions enables relabeling, reordering and merging of factor levels. It is also possible to add and exclude levels, and turn missing values into a separate level.
reFactor(x, L, na.level = NULL, exclude = NULL, new.last = FALSE, warn = TRUE)
x |
factor or character vector to be relabelled or reordered |
L |
a list specifying the relabeling/reordering |
na.level |
if not |
exclude |
a value to make into NA's |
new.last |
if |
warn |
do you want warnings when doing stupid things? |
This function will be refactor
in the 'dataman' package.
(It will be eventually be removed so as to not clutter the 'ucR' package too
much, but I don't want to break to much code in current use!)
Henrik Renlund
factor
, relevel
x <- LETTERS[1:5] # x <- factor(x)
L <- list(B=c("nyB", "C"),E=NULL, D="nyD")
reFactor(x,L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.