与boxplot
相关的两个问题:
na.action
有哪些选项?文档没有列出它们。答案 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