powered by
This functions works quite equally as the wtd.table function from the Hmisc package.
wtd.table
Hmisc
wtdTable(x , weights , na.rm = FALSE)
a frequency table
a character or category or factor vector
a numeric vector of non-negative weights
set to FALSE to suppress checking for NAs. If TRUE, NAs are removed from x as well as from weights prior to variance estimation.
FALSE
TRUE
x
weights
x <- c(50, 1, 50) w <- c(1, 4, 1) wtdTable(x, w)
Run the code above in your browser using DataLab