
Last chance! 50% off unlimited learning
Sale ends in
A hybrid of S-PLUS and R definitions of the variance function.
variance(x, na.rm=TRUE, unbiased=FALSE)
the sample variance of the input.
a numeric vector
, matrix
, or data.frame
.
a logical flag. If TRUE
, NA values are removed prior to computation. Default: TRUE
.
a logical flag. If TRUE
, the unbiased sample variance is returned. Default: FALSE
.
Allows the user to calculate the biased/unbiased variance of the input and provides the option to eliminate NA values as well.
var
.
set.seed(100)
x <- rnorm(100)
variance(x, unbiased=TRUE)
variance(x, unbiased=FALSE)
variance(c(x,rep(NA,30)), na.rm=TRUE)
Run the code above in your browser using DataLab