powered by
Duplicating rows according to a weighting variable. This is the opposite operation of `count_dt`. Analogous to `tidyr::uncount`.
uncount_dt(.data, wt, .remove = TRUE)
A data.frame
A vector of weights.
Should the column for weights be removed? Default uses TRUE.
weights
TRUE
count, uncount
count
uncount
df <- data.table(x = c("a", "b"), n = c(1, 2)) uncount_dt(df, n) uncount_dt(df,n,FALSE)
Run the code above in your browser using DataLab