[Rd] "na.action" parameter in princomp() (PR#3481)

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jul 18 11:08:59 MEST 2003


It should not:  na.action is only a valid argument for the formula method,

Current R-devel says

Usage:

     ## S3 method for class 'formula':
     princomp(formula, data = NULL, subset, na.action, ...)
     ## S3 method for class 'default':
     princomp(x, cor = FALSE, scores = TRUE, covmat = NULL,
              subset = rep(TRUE, nrow(as.matrix(x))), ...)

which may help you see where you misread.

Just apply na.omit to the matrix/data.frame argument directly.


On Tue, 15 Jul 2003 jerome at hivnet.ubc.ca wrote:

> Full_Name: Jerome Asselin
> Version: 1.7.1
> OS: Red Hat Linux 7.2
> Submission from: (NULL) (24.77.125.119)
> 
> 
> 
> Setting the parameter na.action=na.omit should remove
> incomplete records in princomp. However this does not
> seem to work as expected. See example below.
> 
> Sincerely,
> Jerome Asselin
> 
> 
> data(USArrests)
> princomp(USArrests, cor = TRUE) #THIS WORKS
> 
> USArrests[1,3] <- NA
> princomp(USArrests, cor = TRUE, na.action=na.omit) #THIS FAILS!
> #Error in cov.wt(z) : x must contain finite values only
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
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



More information about the R-devel mailing list