Description Usage Arguments Details Value See Also Examples
bootstrapify()
creates a bootstrapped tibble with virtual groups.
1 | bootstrapify(data, times, ..., key = ".bootstrap")
|
data |
A tbl. |
times |
A single integer specifying the number of resamples.
If the |
... |
Not used. |
key |
A single character specifying the name of the virtual group that is added. |
The following functions have special / interesting behavior when used with
a resampled_df
:
dplyr::collect()
dplyr::summarise()
dplyr::do()
dplyr::group_map()
dplyr::group_modify()
dplyr::group_walk()
dplyr::group_nest()
dplyr::group_split()
A resampled_df
with an extra group specified by the key
.
Other virtual samplers: samplify
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 | library(dplyr)
library(broom)
bootstrapify(iris, 5)
iris %>%
bootstrapify(5) %>%
summarise(per_strap_mean = mean(Petal.Width))
iris %>%
group_by(Species) %>%
bootstrapify(5) %>%
summarise(per_strap_species_mean = mean(Petal.Width))
iris %>%
bootstrapify(5) %>%
do(tidy(lm(Sepal.Width ~ Sepal.Length + Species, data = .)))
# Alternatively, use the newer group_modify()
iris %>%
bootstrapify(5) %>%
group_modify(~tidy(lm(Sepal.Width ~ Sepal.Length + Species, data = .x)))
# Alter the name of the group with `key`
# Materialize them with collect()
straps <- bootstrapify(iris, 5, key = ".straps")
collect(straps)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.