Error in model.frame.default(object, data, xlev = xlev) : object is not a matrix
问题 3 days old to R and can't figure out what I'm doing wrong. I'm trying to send some columns with two way interactions into a glmnet cox model. I have some data.frame() called dtable Edit to make the code reproducible xs<-c("Col1", "Col2", "Col3") v<-c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, NA, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, NA, 25, 26, 27, 28, 29, 30) df<-data.frame(matrix(v,ncol=3)) dm<-as.matrix(df) dm<-matrix(dm[complete.cases(dm)], ncol=3) colnames(dm)<-xs dfdata<-data.frame(dm) f