Is there an efficient way to create a series of dummy codes from a single variable? For example, I have a variable, “grade” = {2, …, 12}. I want to create  k-1 dummy codes for grade such that grade 2 is the base (i.e, grade 2 =0).

I am hoping that the new variables can be labeled as grade.3, grade.4 etc. I'll then  use 

grade <- paste("grade.", 3:12, sep="") in as.formula to build the model.

Thanks,

Harold


	[[alternative HTML version deleted]]


