Really? I can't recall a single instance where such things worked outside
of formula methods for functions and I tend to equate its use with the
standard non-standard evaluation idiom.

It could easily remove the NAs, but you wanted na.exclude which means
remove them whilst computing but put them back in in the correct place in
the results. Doing this adds complexity to a code base. We have this
effectively for free in the standard non-standard evaluation methods
employed by most functions with formula methods. And of course:

    princomp(na.omit(x))

gives one simple way to remove them without hardcoding checks for NAs in
each and every function that one might reasonably expect to remove NAs.

G


On 30 May 2014 08:57, Ravi Varadhan <ravi.varad...@jhu.edu> wrote:

>  Gavin,
>
> I agree w.r.t. documenting all arguments.  However, it is quite natural to
> expect that something as basic as `na.action’ would work for more generally
> than with only one particular type of usage.  Why should the behavior of
> princomp(x, …), where x is a data matrix or dataframe be any different than
> when a formula is provided, with regards to the NA action?  It should be
> easy enough to remove the rows of `x’ with NAs.  This is my main point.
>
>
>
> Ravi
>
>
>
> *From:* Gavin Simpson [mailto:ucfa...@gmail.com]
> *Sent:* Friday, May 30, 2014 10:46 AM
> *To:* Ravi Varadhan
> *Cc:* peter dalgaard; r-devel@r-project.org
>
> *Subject:* Re: [Rd] A bug in princomp(), perhaps?
>
>
>
> Ravi,
>
>
>
> You mean something /more/ explicit than the Usage section, wherein
> `na.action` only exists in the formula method?
>
>
>
> I doubt we'd want RCore to go down the road of documenting all the
> arguments that do/don't work with particular methods included in an Rd
> file, beyond the Usage section.
>
>
>
> G
>
>
>
> On 30 May 2014 06:33, Ravi Varadhan <ravi.varad...@jhu.edu> wrote:
>
> Thank you, Peter.  Now I see that.
>
> I still think the documentation of `na.action' can be made more explicit
> to state that this option is only used for princomp.formula.
>
> Best regards,
> Ravi
>
>
> -----Original Message-----
> From: peter dalgaard [mailto:pda...@gmail.com]
> Sent: Friday, May 30, 2014 5:15 AM
> To: Ravi Varadhan
> Cc: r-devel@r-project.org
> Subject: Re: [Rd] A bug in princomp(), perhaps?
>
> It's only documented to work for princomp.formula; other methods do not
> know about na.action.
>
> -pd
>
> On 29 May 2014, at 22:10 , Ravi Varadhan <ravi.varad...@jhu.edu> wrote:
>
> > Hi,
> > It may be my misunderstanding, but it seems that the "na.action" in the
> princomp() function for principal components analysis does not work.
>  Please see this simple example:
> >
> > u <- matrix(rnorm(75), ncol=1)
> > v <- matrix(rnorm(20), ncol=1)
> > x <- u%*%t(v) + matrix(rnorm(20*75),ncol=20) x[1,1] <- NA pc.out <-
> > princomp(x, na.action=na.exclude) Error in cov.wt(z) : 'x' must
> > contain finite values only
> >>
> >
> > Note, I have:
> >> options("na.action")
> > $na.action
> > [1] "na.omit"
> >
> > Thanks,
> > Ravi
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000
> Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd....@cbs.dk  Priv: pda...@gmail.com
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>
>
>
>
> --
>
> Gavin Simpson, PhD
>
>


-- 

Gavin Simpson, PhD

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to