4.1 Basic Statistics
Central Tendency
x <- 1:40
mean(x)
## [1] 20.5
median(x)
## [1] 20.5
summary(x) #Five-number summary
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.00 10.75 20.50 20.50 30.25 40.00
Dispersion
range(x) #Get minimum and maximum
## [1] 1 40
IQR(x) #Inter-quartile range
## [1] 19.5
var(x) #variance
## [1] 136.6667
sd(x) #Standard deviation
## [1] 11.69045