uncount | R Documentation |
Uncount a data.table
uncount(.df, weights, .remove = TRUE, .id = NULL)
.df |
A data.frame or data.table |
weights |
A column containing the weights to uncount by |
.remove |
If TRUE removes the selected |
.id |
A string name for a new column containing a unique identifier for the newly uncounted rows. |
df <- data.table(x = c("a", "b"), n = c(1, 2))
uncount(df, n)
uncount(df, n, .id = "id")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.