Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

uncount_dt

"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

Examples

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

tidyfst

Tidy Verbs for Fast Data Manipulation

v0.9.9
MIT + file LICENSE
Authors
Tian-Yuan Huang [aut, cre] (<https://orcid.org/0000-0002-3591-4203>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.