Displaying 1 result from an estimated 1 matches for "logic_mat".
Did you mean:
loc_mat
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