Skip to content

plot functions, formula interfaces and NAs

2 messages · Brian Ripley, Thomas Lumley

#
As we have seen from PR#6846, we don't document much what happens to NAs
in plot functions.  The formula interfaces do seem to be a bit of a mess,
as they call model.frame and so some (but only some) of them pick up the
options() setting of na.action.  This means that for example

pairs(~ x +y + z)  and pairs(cbind(x, y, z))

may well treat NAs differently, depending on the value of 
getOption("na.action").

However, the formula methods for plot, lines and points do ignore
getOption("na.action") and use na.action=NULL (or equivalently, na.pass).

I believe no function should be using getOption("na.action") without a 
means to override it, and thus the formula methods of

boxplot, mosaicplot and  pairs

should get an na.action argument.  Further, since in all cases the 
non-formula methods do handle missing values, I think the default should 
be na.pass.  That is a change in behaviour, but the existing behaviour is 
undocumented.

The proposal is to document this for 1.9.1 and change it for 2.0.0.
#
On Mon, 3 May 2004, Prof Brian Ripley wrote:

            
As I know Brian realises, but other people may not, it is not sufficient
just to add na.action=na.pass as a default argument in a function that
uses the usual match.call/eval.parent method to handle formulas.  The
default will be overridden by the default in model.frame.


	-thomas