From bbolker at gmail.com  Thu Feb  9 17:45:52 2012
From: bbolker at gmail.com (Ben Bolker)
Date: Thu, 09 Feb 2012 11:45:52 -0500
Subject: [Rd] na.omit option in prcomp: formula interface only
Message-ID: <4F33F840.50406@gmail.com>


  This is a wishlist/request for discussion about the behaviour of the
na.action option in prcomp, specifically the fact that it only applies
to the formula interface.

   I had a question from a friend (who is smart and careful and
generally R's TFM, although like all of us he misses things sometimes)
asking why the na.action= argument didn't seem to be doing anything in
prcomp (i.e. one gets an "Error in svd(x, nu=0): infinite or missing
values in 'x'").  Some poking later, I realized that na.action only
applied to the formula interface (so I told him to try
prcomp(~.,data=x,...) instead).  Sufficiently careful reading of the
help page, with hindsight, revealed that na.action only appears in the
arguments for the formula method, not the default (on the other hand,
'scale.' only appears in the default formula, but it *does* work with
prcomp.formula as well, because prcomp.formula passes ... through to
prcomp.default ...)

  Would it be reasonable to (at least) add a sentence to the
documentation saying that na.action applies only to the formula
interface or (possibly) to add some NA-processing machinery to
prcomp.default to allow it to handle na.action as well?  (I can
appreciate from looking at stats:::prcomp.formula that the NA-processing
is not completely trivial ...)

  Ben Bolker



[Rd] na.omit option in prcomp: formula interface only
Ben Bolker