Description Usage Arguments Examples
Parse a character string into factor
1 | parseFactor(str, rlevels = NULL, make.names = TRUE, collapse = ",")
|
str |
A character string giving groups |
rlevels |
A character string giving levels |
make.names |
Logical, should names be converted to adhere to the rule of variable names in R |
collapse |
Character used in |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | parseFactor("A,B,C,B,A", rlevels="A,B,C")
rgroup <- "A,B,C,D,B,C,A,D,B"
rlevels <- "D,A,B,C"
parseFactor(rgroup, rlevels)
groups <- c("ATest", "Control", "Control", "ATest")
levels <- c("Control", "ATest")
makeFactor(groups, levels)
# if 'groups' is a factor and 'levels' NULL or missing, its levels are respected
groups <- factor(c("B", "C", "A", "D"), levels=c("D","C","A","B"))
makeFactor(groups)
## Not run:
groups <- c("ATest", "Control", "Control", "ATest")
levels <- c("Control", "ATest", "Unknown")
makeFactor(groups, levels)
groups <- c("ATest", "Control", "Control", "ATest", "BTest")
levels <- c("Control", "ATest")
makeFactor(groups, levels)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.