Displaying 1 result from an estimated 1 matches for "numeric_mat".
Did you mean:
numeric_data
2009 Apr 23
0
Creating a model.matrix with a logical data matrix
Hi,
I'm trying to create a model.matrix (or use lm, which result in the
same issue), using a logical data matrix.
When I use a numerical matrix, I can do:
numeric_mat<-matrix(c(1,2,3,4),c(2,2))
model.matrix(~numeric_mat)
and it works well.
When I use logical matrix:
logic_mat<-matrix(c(TRUE,FALSE,FALSE,TRUE),c(2,2))
#The following works:
model.matrix(~logic_mat[,1]+logic_mat[,2])
#but this fails:
model.matrix(~logic_mat)
Any hint?
Thanks, Ehud