uncount: "Uncount" a data frame

View source: R/uncount.R

uncountR Documentation

"Uncount" a data frame

Description

Performs the opposite operation to 'dplyr::count()', duplicating rows according to a weighting variable (or expression). Analogous to 'tidyr::uncount'.

Usage

uncount(.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.

Value

A data.table

See Also

count, uncount

Examples


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

tidyft documentation built on Sept. 30, 2024, 9:40 a.m.