Description Usage Arguments Details Source Examples
Common functions for calculating central tendancies but with NA parameters set to TRUE unlike the defaults.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
x |
a vector |
w |
a weight variable |
Credits to John Bullock for the inspiration. Some of this is from his Bullock package, but others are my own.
https://github.com/jbullock35/Bullock
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | x <- c(1, 1, 2, 3, 5, 8, 13, 21, NA, NA, NA)
w <- c(0, 0, 0, 1, 1, 2, 2, 2, 0, 0, 0)
# Mode
modeNA(x) # 1
# Mean and Weighted Mean
meanNA(x) # 6.75
wMeanNA(x, w) # 11.5
# Median
medianNA(x) # 4
# Range
minNA(x) # 1
maxNA(x) # 21
rangeNA(x) # c(1, 21)
# Sum
sumNA(x) # 54
# Variance and Standard Deviation
varNA(x)
sdNA(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.