11

与以下相关的两个问题boxplot

  1. 有哪些选择na.action?文档没有列出它们。
  2. 将来我将如何回答这些类型的问题?
4

2 回答 2

8

总的来说,我发现内置帮助非常好。你是对的,尽管提到的帮助页面boxplot没有na.action说明选项是什么。

在这种情况下,?na.action然后——从那里开始——?na.omit解释可能性(这些是非常普遍的,也适用于除 之外的事物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’.
于 2011-04-05T20:17:44.970 回答
0

此选项可帮助 R 软件在计算和任何图形绘制期间忽略缺失值:

na.rm=TRUE
于 2018-09-23T14:30:27.887 回答