R functions for numerical data

R provides functions to calculate common summary statistics. Each of the following functions requires a vector of numeric elements as input.

# take the mean of the integer values 1-10
mean(1:10)
[1] 5.5
# take mean of the values 1, 2.2, and 0
mean(c(1, 2.2, 0))
[1] 1.066667
# take the variance and standard deviation of the integer values 1-10
var(1:10)
[1] 9.166667
sd(1:10)
[1] 3.02765
# confirm relationship between std. deviation and variance
sqrt(var(1:10))
[1] 3.02765