From ripley at stats.ox.ac.uk  Sat Jun 17 08:43:22 2006
From: ripley at stats.ox.ac.uk (ripley at stats.ox.ac.uk)
Date: Sat, 17 Jun 2006 08:43:22 +0200 (CEST)
Subject: [Rd] bug in prcomp (PR#8994)
Message-ID: <20060617064322.CF5B71DD29@slim.kubism.ku.dk>

The default method for prcomp does not have an na.action argument:

Usage:

      prcomp(x, ...)

      ## S3 method for class 'formula':
      prcomp(formula, data = NULL, subset, na.action, ...)

      ## Default S3 method:
      prcomp(x, retx = TRUE, center = TRUE, scale. = FALSE, tol = NULL, ...)

so this is as documented.  In general only formula-based interfaces do 
have subset and na.action.


On Fri, 16 Jun 2006, KjetilBrinchmannHalvorsen at gmail.com wrote:

> The following seems to be an bug in prcomp():
>
> > test <- ts( matrix( c(NA, 2:5, NA, 7:10), 5, 2))
> > test
> Time Series:
> Start = 1
> End = 5
> Frequency = 1
>   Series 1 Series 2
> 1       NA       NA
> 2        2        7
> 3        3        8
> 4        4        9
> 5        5       10
> > prcomp(test, scale.=TRUE, na.action=na.omit)
> Erro en svd(x, nu = 0) : infinite or missing values in 'x'
> > prcomp(na.omit(test), scale.=TRUE, na.action=na.omit)
> Standard deviations:
> [1] 1.414214e+00 3.726778e-17
>
> Rotation:
>                PC1        PC2
> Series 1 0.7071068 -0.7071068
> Series 2 0.7071068  0.7071068
> >
> note that
> > is.matrix(test)
> [1] TRUE
>
> This is R2.3.1 pre-compiled binary from CRAN on windows XP.
>
> > sessionInfo()
> Version 2.3.1 (2006-06-01)
> i386-pc-mingw32
>
> attached base packages:
> [1] "methods"   "stats"     "graphics"  "grDevices" "utils"
> "datasets"  "base"
>
>
> Kjetil
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.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



[Rd] bug in prcomp (PR#8994)
ripley at stats.ox.ac.uk