# NOT RUN {
## set up a factor with labels
Treats <- factor(rep(1:4, 4), labels=c("A","B","C","D"))
## recode "A" and "D" to "a" and "B" and "C" to "b"
B <- fac.uselogical(Treats %in% c("A", "D"), labels = c("a","b"))
B <- fac.uselogical(Treats %in% c("A", "D"), labels = c(-1,1))
## suppose level A in factor a is a control treatment
## set up a factor Control to discriminate between control and treated
Control <- fac.uselogical(Treats == "A")
# }
Run the code above in your browser using DataCamp Workspace