"Trevor Hastie" <[EMAIL PROTECTED]> writes: > This does not: > > > model.matrix(~I(pos>3),data=data.frame(pos=c(1:2))) > Error in "contrasts<-"(`*tmp*`, value = "contr.treatment") : > contrasts can be applied only to factors with 2 or more levels
Oh yes it does: > model.matrix(~I(pos>3),data=data.frame(pos=c(1:2))) (Intercept) I(pos > 3)TRUE 1 1 0 2 1 0 attr(,"assign") [1] 0 1 attr(,"contrasts") attr(,"contrasts")$"I(pos > 3)" [1] "contr.treatment" (RedHat,SuSE,x86,amd64) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html