variance | R Documentation |
Variance
variance(x, sample = FALSE, na.rm = FALSE)
x |
numerical vector. |
sample |
logical. Compute sample variance or apply correction? |
na.rm |
logical. Should missing values be removed? |
The variance, with ou whithout sample correction.
# variance of the height in EUR2170 data
variance(EUR2170$height, sample = TRUE)
# adults only
he <- subset(EUR2170, age > 20, "height")
variance(he, sample = TRUE)
# males and females separately
heM <- subset(EUR2170, age > 20 & sex == "M", "height")
heF <- subset(EUR2170, age > 20 & sex == "F", "height")
variance(heM, sample = TRUE)
variance(heF, sample = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.