dbplyr_uncount | R Documentation |
This is a method for the tidyr uncount()
generic. It uses a temporary
table, so your database user needs permissions to create one.
dbplyr_uncount(data, weights, .remove = TRUE, .id = NULL)
data |
A lazy data frame backed by a database query. |
weights |
A vector of weights. Evaluated in the context of |
.remove |
If |
.id |
Supply a string to create a new variable which gives a unique identifier for each created row. |
df <- memdb_frame(x = c("a", "b"), n = c(1, 2))
dbplyr_uncount(df, n)
dbplyr_uncount(df, n, .id = "id")
# You can also use constants
dbplyr_uncount(df, 2)
# Or expressions
dbplyr_uncount(df, 2 / n)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.