
Hallo

>From a variable "x" that defines, say, four classes, I would like to define
the matrix "mat" of dummy variables indicating the classes, i.e.

x <- c(1,1,1,1,2,2,2,3,3,3,4,4)
mat <- matrix(c(1,0,0,0,
1,0,0,0,
1,0,0,0,
1,0,0,0,
0,1,0,0,
0,1,0,0,
0,1,0,0,
0,0,1,0,
0,0,1,0,
0,0,1,0,
0,0,0,1,
0,0,0,1), ncol=4, byrow=T)

Thank you for your help,
Serguei
	[[alternative HTML version deleted]]

