mean(c(1,2,21))
#[1] 8
This passes a vector of three elements to the mean
function and the mean value of these three elements is calculated.
mean(1,2,21)
#[1] 1
This passes 1
as the first argument, 2
as the second argument and 21
as the third argument to the mean
function. mean
passes these arguments to mean.default
. In help("mean.default")
you can find the arguments of this function:
- The object you want the mean for.
- 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.
- a logical value indicating whether NA values should be stripped before the computation proceeds. (Since you pass a numeric value, it is coerced to logical automatically).
So you calculate this:
mean.default(1, 0.5, TRUE)
[1] 1
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…