I'm not sure, but is this what you want matrix(as.numeric(factor(c(T,F,F,T))), 2,2)
Tom Mulholland > -----Original Message----- > From: Adrian Baddeley [mailto:[EMAIL PROTECTED] > Sent: Friday, 3 December 2004 1:45 PM > To: [EMAIL PROTECTED] > Subject: [R] factor matrix > > > Sorry if this is a FAQ. > > Is there a good reason why a factor has to be > a one-dimensional vector and cannot be a matrix? > > I want to construct matrices of categorical values. > > Vain attempts like > matrix(factor(c(T,F,F,T), 2,2) > yield a matrix of character strings representing the factor levels, > not the levels themselves, while > factor(matrix(c(T,F,F,T), 2,2)) > converts the matrix to a logical vector of length 4 > then converts the vector to a factor. > > Tia > --- > Adrian Baddeley > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html