weighted.tabulate {midr} | R Documentation |
Weighted Tabulation for Vectors
Description
weighted.tabulate()
returns the sum of weights for each integer in the vector bin
.
Usage
weighted.tabulate(bin, w = NULL, nbins = max(1L, bin, na.rm = TRUE))
Arguments
bin |
a numeric vector of positive integers, or a factor. |
w |
a numeric vector of the sample weights for each value in |
nbins |
the number of bins to be used. |
Details
weighted.tabulate()
is a wrapper function of tabulate()
to reflect sample weights.
Value
weighted.tabulate()
returns an numeric vector.
Examples
tabulate(bin = c(2, 2, 3, 5))
weighted.tabulate(bin = c(2, 2, 3, 5), w = 1:4)
[Package midr version 0.5.0 Index]