Ben Bolker <bbolker <at> gmail.com> writes:
FWIW this seems to be a FAQ: https://stat.ethz.ch/pipermail/r-devel/2003-July/027018.html http://thr3ads.net/r-devel/2013/01/ 2171832-Re-na.omit-option-in-prcomp-formula-interface-only http://r.789695.n4.nabble.com/ na-omit-option-in-prcomp-formula-interface-only-td4373533.html And two StackOverflow questions (the latter's a bit tangential): http://stackoverflow.com/questions/12078291/ r-function-prcomp-fails-with-nas-values-even-though-nas-are-allowed http://stackoverflow.com/questions/23421438/ what-was-wrong-with-running-princomp-in-r/23446938#23446938 (Sorry for broken URLs and random assortment of mailing list aggregators.) I appreciate Gavin's points that implementing this stuff for princomp.default is difficult/problematic, but I second Ravi's request for a little more clarification in the help text; it's quite easy to miss the fact that 'na.action' is defined for princomp.formula but not for princomp.default. Perhaps just "Note that setting na.action works for princomp.formula, but not for princomp.default" (under the "na.action" argument description).
Putting my effort where my mouth is: I wonder if there is any chance
that this patch against the current SVN would be accepted ... ??
Index: princomp.Rd
===================================================================
--- princomp.Rd (revision 65832)
+++ princomp.Rd (working copy)
@@ -37,7 +37,8 @@
when the data contain \code{NA}s. The default is set by
the \code{na.action} setting of \code{\link{options}}, and is
\code{\link{na.fail}} if that is unset. The \sQuote{factory-fresh}
- default is \code{\link{na.omit}}.}
+ default is \code{\link{na.omit}}. (This argument applies \emph{only}
+ to the formula method.)}
\item{x}{a numeric matrix or data frame which provides the data for the
principal components analysis.}
\item{cor}{a logical value indicating whether the calculation should
Index: prcomp.Rd
===================================================================
--- prcomp.Rd (revision 65832)
+++ prcomp.Rd (working copy)
@@ -40,7 +40,8 @@
when the data contain \code{NA}s. The default is set by
the \code{na.action} setting of \code{\link{options}}, and is
\code{\link{na.fail}} if that is unset. The \sQuote{factory-fresh}
- default is \code{\link{na.omit}}.}
+ default is \code{\link{na.omit}}. (This argument applies \emph{only}
+ to the formula method.)}
\item{\dots}{arguments passed to or from other methods. If \code{x} is
a formula one might specify \code{scale.} or \code{tol}.}
\item{x}{a numeric or complex matrix (or data frame) which provides