在箱线图中,na.action有哪些选项?

12

关于boxplot的两个问题:

  1. na.action有哪些选项?文档中没有列出。
  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’.

2
发布完整的帮助文件内容并不是答案。?na.action 的一个问题是它很难理解。 - buhtz

0

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

na.rm=TRUE

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接