Similar to uncount but using base R only

unkount(x, weight)

Arguments

x

a data frame

weight

column in x with number of replicates, no need to "quote"

Examples

x <- data.frame(a = c(1, 2), b = c(3, 4))
unkount(x, b)
#>     a b
#> 1   1 3
#> 1.1 1 3
#> 1.2 1 3
#> 2   2 4
#> 2.1 2 4
#> 2.2 2 4
#> 2.3 2 4