I would like to create a function that return design contrast matrix of factors with number of factors, levels in each factor as input. Im my example, I have:
@media only screen and (min-width:768){
.canvas {
height: 80px;
}
}
treat <- gl(3, 20, labels = paste("t", 1:3, sep=""))
imp <- rep(gl(2, 10, labels = c("yes", "no")), 3)
contrasts(imp) <- c(-1, 1)
Imp <- model.matrix(~ imp)[, -1]
Now I ask how I can start for create Imp and Treat matrix and all combination of Imp and Treat, given Factor=2, Levels = c(3,2) and Nsize=60, for example?