Present since v1.0.0
.
Argument rows.out
available since v1.3.0
;
rows.out < 1
supported since v 1.4.0
.
Argument discard_weight.var
available since v1.3.0
.
weight2rows(DT, weight.var, rows.out = NULL, discard_weight.var = FALSE)
DT | A |
---|---|
weight.var | Variable in |
rows.out | If not Since |
discard_weight.var | If |
DT
but with the number of rows expanded to sum(DT[[weight.var]])
to reflect the weighting.
#> x y #> 1: 1 1 #> 2: 2 1 #> 3: 3 1 #> 4: 4 1 #> 5: 5 1 #> 6: 5 1weight2rows(DT, "y", rows.out = 5)#> x y #> 1: 1 0.8333333 #> 2: 2 0.8333333 #> 3: 3 0.8333333 #> 4: 4 0.8333333 #> 5: 5 0.8333333 #> 6: 5 0.8333333