What are the options for na.action in boxplot?
Asked Answered
G

2

12

Two questions related to boxplot:

  1. What are the options for na.action? The documentation doesn't list them.
  2. How would I go about answering these types of question in the future?
Googolplex answered 5/4, 2011 at 19:52 Comment(0)
E
8

In general, I find the built-in help to be pretty good. You're right though that the help page for boxplot mentions na.action without stating what the options are.

In this instance, ?na.action and -- following on from there -- ?na.omit explain the possibilities (these are quite general and also apply to things other than boxplot.)

Handle Missing Values in Objects

Description:

     These generic functions are useful for dealing with ‘NA’s in e.g.,
     data frames.  ‘na.fail’ returns the object if it does not contain
     any missing values, and signals an error otherwise.  ‘na.omit’
     returns the object with incomplete cases removed.  ‘na.pass’
     returns the object unchanged.

Usage:

     na.fail(object, ...)
     na.omit(object, ...)
     na.exclude(object, ...)
     na.pass(object, ...)

Arguments:

  object: an R object, typically a data frame

     ...: further arguments special methods could require.

Details:

     At present these will handle vectors, matrices and data frames
     comprising vectors and matrices (only).

     If ‘na.omit’ removes cases, the row numbers of the cases form the
     ‘"na.action"’ attribute of the result, of class ‘"omit"’.

     ‘na.exclude’ differs from ‘na.omit’ only in the class of the
     ‘"na.action"’ attribute of the result, which is ‘"exclude"’.  This
     gives different behaviour in functions making use of ‘naresid’ and
     ‘napredict’: when ‘na.exclude’ is used the residuals and
     predictions are padded to the correct length by inserting ‘NA’s
     for cases omitted by ‘na.exclude’.
Extricate answered 5/4, 2011 at 20:17 Comment(1)
Posting full content of help files are not answers. One problem of ?na.action is that it is hard to understand.Triennium
C
0

This option helps the R software to ignore missing values during computations and any graph plotting:

na.rm=TRUE
Cotyledon answered 23/9, 2018 at 14:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.