If I have a variable (condition) of 2 levels and want to create a model.matrix R automatically assigns conditionB as the term in the design matrix.
condition <- as.factor( c("A","A","A","B","B","B"))
df <- data.frame(condition)
design <- model.matrix( ~ condition)
> df
condition
1 A
2 A
3 A
4 B
5 B
6 B
> design
(Intercept) conditionB
1 1 0
2 1 0
3 1 0
4 1 1
5 1 1
6 1 1
attr(,"assign")
[1] 0 1
attr(,"contrasts")
attr(,"contrasts")$condition
[1] "contr.treatment"
Question: I would like to have my results relative to conditionA. How can I specify this in model.matrix() ?
(A workaround would be to inverse the resulting FCs)