thank you.  I am still not sure how to get the scores in princomp, though:

ds= as.data.frame( cbind(rnorm(10),rnorm(10)) )
names(ds)=c("x1","x2")
ds[5,]=c(NA,NA)
pc= princomp( formula = ~ ds$x1 + ds$x2, na.action=na.omit)
ds$pc1 = pc$scores[,1]  #<-- error, scores has 9 obs, ds has 10 obs

is there an elegant method to do this, or do I need to learn how to operate
with pc$loadings?  (may I also humbly suggest that the default behavior or
$scores should be to contain NA in row 5?)

Incidentally, R is a lot cleverer than I understand.  pc$loadings by itself
gives me wonderfully intuitive output, with names, text, different
components---but I can still use p$loadings[,2].  I presume that the array
operator on the "loadings" object is overloaded.  very nice.

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to