model.matrix()
Hi, In R I get the following:
x <- 1:9 f <- as.factor(1:9) i <- model.matrix(~x+f) attr(i, "assign")
[1] 0 1 2 2 2 2 2 2 2 2 whereas in S I get the following:
attr(i, "assign")
$"(Intercept)": [1] 1 $x: [1] 2 $f: [1] 3 4 5 6 7 8 9 10 Has anybody written a model.matrix function to get the same result as S? It's just that S's output is what I want, viz., 1. the names "(Intercept)","x","f", and 2. the vector values. Thanks Thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._