wtdTable: Weighted frequency tables.

Description Usage Arguments Details Value Examples

Description

Compute a weighted frequency table.

Usage

1
wtdTable(x, weights, na.rm = FALSE)

Arguments

x

a character or category or factor vector

weights

a numeric vector of non-negative weights

na.rm

set to FALSE to suppress checking for NAs. If TRUE, NAs are removed from x as well as from weights prior to variance estimation.

Details

This function provides similar functionality as the wtd.table function from Hmisc.

Value

a frequency table

Examples

1
2
3
4
5
x <- c(50, 1, 25)
w <- c(1, 4, 1)

# compute weighted variance
wtdTable(x, w)

beckerbenj/eatWtd documentation built on Aug. 22, 2020, 9:43 p.m.