SummaryStats: Summary Statistics Calculations

Description Usage Arguments Details Source Examples

Description

Common functions for calculating central tendancies but with NA parameters set to TRUE unlike the defaults.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
modeNA(x)

meanNA(x)

wMeanNA(x, w)

medianNA(x)

minNA(x)

maxNA(x)

rangeNA(x)

sdNA(x)

sumNA(x)

varNA(x)

Arguments

x

a vector

w

a weight variable

Details

Credits to John Bullock for the inspiration. Some of this is from his Bullock package, but others are my own.

Source

https://github.com/jbullock35/Bullock

Examples

 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)

lin-jennifer/lin documentation built on Jan. 1, 2021, 8:21 a.m.