uncount_dt: "Uncount" a data frame

View source: R/uncount.R

uncount_dtR Documentation

"Uncount" a data frame

Description

Duplicating rows according to a weighting variable. This is the opposite operation of 'count_dt'. Analogous to 'tidyr::uncount'.

Usage

uncount_dt(.data, wt, .remove = TRUE)

Arguments

.data

A data.frame

wt

A vector of weights.

.remove

Should the column for weights be removed? Default uses TRUE.

See Also

count, uncount

Examples


df <- data.table(x = c("a", "b"), n = c(1, 2))
uncount_dt(df, n)
uncount_dt(df,n,FALSE)

tidyfst documentation built on July 26, 2023, 5:20 p.m.