【发布时间】:2017-10-07 14:57:28
【问题描述】:
x <- c(0:2, 50)
mean(x,0.9)
#[1] 1.5
mean(x)
#[1] 13.25
mean(x,0.10)
#[1] 13.25
mean(x,0.50)
#[1] 1.5
mean(x,0.4)
#[1] 1.5
mean(x,0.3)
#[1] 1.5
mean(x,0.2)
#[1] 13.25
谁能详细解释trim参数在R函数中的工作原理
【问题讨论】:
-
你读过
?mean吗? -
当然我把平均函数加红了……但我不明白……也把线程红了stat.ethz.ch/pipermail/r-help/2005-September/079213.html
-
我还发现文档令人困惑,因为现在在阅读下面的答案后,我的反应是“为什么这个属性有用,为什么我在其他脚本语言(如 python/ php等...”
-
@nicola
?mean仅将trim列为有效参数,没有说明它是什么或应该如何解释。 -
@user3338098 我从
?mean读到这个:trim: the fraction (0 to 0.5) of observations to be trimmed from each end of ‘x’ before the mean is computed. Values of trim outside that range are taken as the nearest endpoint.在Value部分有详细解释它的含义。