From ripley at stats.ox.ac.uk  Fri Jul 18 11:08:59 2003
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri Jul 18 11:08:54 2003
Subject: [Rd] "na.action" parameter in princomp() (PR#3481)
In-Reply-To: <200307150622.h6F6MeJH024405@pubhealth.ku.dk>
Message-ID: <Pine.LNX.4.44.0307181004440.15007-100000@gannet.stats>

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@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@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Brian D. Ripley,                  ripley@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


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