boxplot中na.action的选项有哪些?

时间:2011-04-05 19:52:43

标签: r

boxplot相关的两个问题:

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

2 个答案:

答案 0 :(得分: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’.

答案 1 :(得分:0)

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

na.rm=TRUE