Description Usage Arguments Value Examples
Applies the ballet()
with no restriction on the vec_size()
of the outputs.
1 2 3 4 5 |
.tbl |
A data frame, most likely a grouped data frame |
..., .env |
formulas for each column to create, and parent environment, see |
.name |
Name of the packed column made by |
foxtrot()
returns a list of tibbles, one per group of .tbl
. This is
close in functionality to dplyr::group_map()
.
bachata()
returns a tibble that vctrs::vec_cbind()
the results of polka()
and
the result from foxtrot()
as a list column
jive()
row binds the results from foxtrot()
and reconstructs the grouping structure.
This is similar in functionality to dplyr::group_modify()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | g <- group_by(iris, Species)
## Not run:
if (requireNamespace("broom", quietly = TRUE)) {
### foxtrot() to return a list of tibbles
# A list of tibbles with the `quantiles` column derived from the
# formula on each group
g %>%
foxtrot(
quantiles = ~quantile(Petal.Length, probs = c(0.25, 0.5, 0.75))
)
g %>%
foxtrot(
~ broom::tidy(lm(Petal.Length ~ Sepal.Length))
)
### bachata() to nest the results of foxtrot()
# bachata() = polka() + a list column of 2 columns tibbles
g %>%
bachata(
Sepal.Length = ~quantile(Sepal.Length, probs = c(0.25, 0.5, 0.75)),
Sepal.Width = ~quantile(Sepal.Width, probs = c(0.25, 0.5, 0.75)),
)
# because the formula is unnamed, the columns of the tibbles
# generated by broom::tidy() are auto-spliced
g %>%
bachata(
~ broom::tidy(lm(Petal.Length ~ Sepal.Length))
)
### jive()
g %>%
jive(
Sepal.Length = ~quantile(Sepal.Length, probs = c(0.25, 0.5, 0.75)),
Sepal.Width = ~quantile(Sepal.Width, probs = c(0.25, 0.5, 0.75)),
)
# unnamed -> columns are spliced
g %>%
jive(
~ broom::tidy(lm(Petal.Length ~ Sepal.Length))
)
# named -> packed column
g %>%
jive(
model = ~ broom::tidy(lm(Petal.Length ~ Sepal.Length))
)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.