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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to