sd
Compute Standard Deviation
Description
Computes the standard deviation of a vector
Usage
sd(x, na.rm = FALSE)
Arguments
x |
a numeric vector, or something that can be converted to one with as.double.
|
na.rm |
a logical value. If TRUE, missing values (NAs) are
removed. Otherwise a missing value in the input causes the output
to be missing value. Default value is FALSE.
|
Value
returns the standard deviation (the square root of the variance) of the vector.
Note
In version 2.5 of Spotfire Enterprise Runtime for R and before and in version 2.15.3 of Open Source R and before,
sd computed the standard deviation of each column of a data.frame or matrix.
It no longer does (this makes it act like the other univariate summary functions).
See Also
Examples
sd(log(1:12))
sqrt(var(log(1:12)))
sd(c(1, NA, 3.5, 6.7, 9.0))
sd(c(1, NA, 3.5, 6.7, 9.0), na.rm=TRUE)