"Uncount" a data frame
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)
.data |
A data.frame |
wt |
A vector of weights. |
.remove |
Should the column for |
df <- data.table(x = c("a", "b"), n = c(1, 2)) uncount_dt(df, n) uncount_dt(df,n,FALSE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.