Performs the opposite operation to `dplyr::count()`, duplicating rows according to a weighting variable (or expression). Analogous to `tidyr::uncount`.
uncount(.data, wt, .remove = TRUE)
A data.table
df <- data.table(x = c("a", "b"), n = c(1, 2))
uncount(df, n)
#> x
#> <char>
#> 1: a
#> 2: b
#> 3: b
uncount(df,n,FALSE)
#> x n
#> <char> <num>
#> 1: a 1
#> 2: b 2
#> 3: b 2