See ?na.exclude (on the same page as na.omit) On Mon, 16 Jan 2006, ivo welch wrote:
> 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.) See ?princomp: only the formula method has an na.action argument. > 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? There is no function scores(). > 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 > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [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
