# NOT RUN {
Var(1:10) # 9.166667
Var(1:5, 1:5) # 2.5
# weighted Variance
set.seed(45)
(z <- as.numeric(names(w <- table(x <- sample(-10:20, size=50, replace=TRUE)))))
Var(z, w=w)
# check!
all.equal(Var(x), Var(z, w=w))
# Variance for frequency tables
Var(Freq(as.table(c(6,16,24,25,17))),
breaks=c(0, 10, 20, 30, 40, 50))
# }
Run the code above in your browser using DataLab