Well, once and for all, how are you (focus on you, because I'm sure there is more than one way to achieve this), contrast code (treatment, amount, helmert, etc.) and keep meaningful (so that you can make meaningful interpretations of effects) in the glm function?
I understand that I can use level () to figure out which factor level is the link, but this is tedious when I start attracting factors with 5 or 10 levels and their interactions.
Here is a quick two-factor example of what I mean
outcome <- c(1,0,0,1,1,0,0,0,1, 0, 0, 1) firstvar <- c("A", "B", "C", "C", "B", "B", "A", "A", "C", "A", "C", "B") secondvar <- c("D", "D", "E", "F", "F", "E", "D", "E", "F", "F", "D", "E") df <- as.data.frame(cbind(outcome, firstvar, secondvar)) df$firstvar <- as.factor(df$firstvar) df$secondvar <- as.factor(df$secondvar)
Any suggestions would be appreciated. This problem bothered me from time to time, and I'm sure there is a simple solution (ish).