dear R wizards: the good news is that I know how to omit missing
observations and run a principal components analysis.
p= princomp( na.omit( dataset ) )
p$scores[ ,1] # the first factor
(where dataset contains missing values; incidentally, princomp(retailsmall,
na.action=na.omit) does not work for me, so I must be doing something wrong,
here.) the bad news is that I would like NA observations to be retained as
NA, so that I can reinsert the factors into the data set:
dataset$first.factor = p$scores[,1]
there must be an elegant way of doing this. help appreciated.
may I humbly suggest that in linear models, it would be intuitive if the
default would be for NA's to be ignored in the model computations, and that
the functions residuals and fitted (and similar, such as scores() ) to
understand when a particular obs num should be NA?
help, as always, appreciated.
sincerely,
/ivo welch
[[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