[R] expanding factor with NA
J.R. Lockwood
lockwood at rand.org
Mon Oct 27 18:59:45 CET 2003
I have a factor (with "n" observations and "k" levels), with only
"nobs" < n of the observations not missing. I would like to produce a
(n x k) model matrix with treatment contrasts for this factor, with
rows of NAs placeholding the missing observations. If I use
model.matrix() I get back a (nobs x k) matrix. Is there an easy way
to get the (n x k) without carrying along a row ID and merging?
Thanks.
J.R. Lockwood
412-683-2300 x4941
lockwood at rand.org
http://www.rand.org/methodology/stat/members/lockwood/
More information about the R-help
mailing list