Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the options for na.action in boxplot?

Tags:

r

na

boxplot

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?
like image 577
SFun28 Avatar asked Apr 05 '11 19:04

SFun28


People also ask

What is N in Boxplot?

Sample size (n) The sample size can affect the appearance of the graph. For example, although these boxplots seem quite different, both of them were created using randomly selected samples of data from the same population.

What types of data are best for using a Boxplot?

Box plots are used to show distributions of numeric data values, especially when you want to compare them between multiple groups. They are built to provide high-level information at a glance, offering general information about a group of data's symmetry, skew, variance, and outliers.

What are asterisks in a box plot?

Extreme outliers are marked with an asterisk (*) on the boxplot. Mild outliers are data points that are more extreme than than Q1 - 1.5 * IQR or Q3 + 1.5 * IQR, but are not extreme outliers.

How do you increase the clarity of a box plot?

A possible approach is to thicken appropriate vertical lines in the box. Thus, if a distribution is right skewed, replace the edge of the box denoting the lower quartile by a thick line. If it is left skewed, thicken the edge corresponding to the upper quartile. If it is bimodal, thicken both edges.


1 Answers

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’.
like image 117
NPE Avatar answered Nov 09 '22 12:11

NPE