When collect() is used on a resampled_df, the virtual bootstrap groups are made explicit.

# S3 method for resampled_df
collect(x, ..., id = NULL, original_id = NULL)

Arguments

x

A resampled_df.

...

Not used.

id

Optional. A single character that specifies a name for a column containing a sequence from 1:n for each bootstrap group.

original_id

Optional. A single character that specifies a name for a column containing the original position of the bootstrapped row.

Examples

library(dplyr) # virtual groups become real rows collect(bootstrapify(iris, 5))
#> # A tibble: 750 x 6 #> # Groups: .bootstrap [5] #> .bootstrap Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 6.2 3.4 5.4 2.3 virginica #> 2 1 5.2 3.5 1.5 0.2 setosa #> 3 1 7.7 2.6 6.9 2.3 virginica #> 4 1 6.7 3 5 1.7 versicolor #> 5 1 5.1 3.8 1.9 0.4 setosa #> 6 1 5.1 3.5 1.4 0.3 setosa #> 7 1 5.7 2.9 4.2 1.3 versicolor #> 8 1 6.7 3.1 4.7 1.5 versicolor #> 9 1 6.3 2.5 5 1.9 virginica #> 10 1 4.8 3 1.4 0.1 setosa #> # … with 740 more rows
# add on the id column for an identifier per bootstrap collect(bootstrapify(iris, 5), id = ".id")
#> # A tibble: 750 x 7 #> # Groups: .bootstrap [5] #> .bootstrap .id Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> <int> <int> <dbl> <dbl> <dbl> <dbl> <fct> #> 1 1 1 5.4 3 4.5 1.5 versicolor #> 2 1 2 5.4 3.7 1.5 0.2 setosa #> 3 1 3 6.3 2.5 5 1.9 virginica #> 4 1 4 5.7 2.8 4.5 1.3 versicolor #> 5 1 5 4.3 3 1.1 0.1 setosa #> 6 1 6 5 3.6 1.4 0.2 setosa #> 7 1 7 6 2.2 5 1.5 virginica #> 8 1 8 6.4 3.2 4.5 1.5 versicolor #> 9 1 9 5.5 2.4 3.7 1 versicolor #> 10 1 10 6.2 3.4 5.4 2.3 virginica #> # … with 740 more rows
# add on the original_id column to know which row this bootstrapped row # originally came from collect(bootstrapify(iris, 5), original_id = ".original_id")
#> # A tibble: 750 x 7 #> # Groups: .bootstrap [5] #> .bootstrap .original_id Sepal.Length Sepal.Width Petal.Length Petal.Width #> <int> <int> <dbl> <dbl> <dbl> <dbl> #> 1 1 52 6.4 3.2 4.5 1.5 #> 2 1 81 5.5 2.4 3.8 1.1 #> 3 1 117 6.5 3 5.5 1.8 #> 4 1 8 5 3.4 1.5 0.2 #> 5 1 41 5 3.5 1.3 0.3 #> 6 1 149 6.2 3.4 5.4 2.3 #> 7 1 144 6.8 3.2 5.9 2.3 #> 8 1 3 4.7 3.2 1.3 0.2 #> 9 1 43 4.4 3.2 1.3 0.2 #> 10 1 117 6.5 3 5.5 1.8 #> # … with 740 more rows, and 1 more variable: Species <fct>