You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bootstrap_unnest_tbl<-function(.data){
# Checks ----atb<- attributes(.data)
distribution_family_type<-atb$dist_typeif (!atb$tibble_type=="tidy_bootstrap"){
rlang::abort(
message="You must provide the output from the tidy_bootstrap() function.",
use_cli_format=TRUE
)
}
# Data ----df<-tidyr::unnest(.data, bootstrap_samples) %>%
purrr::set_names("sim_number", "y")
# Return ----
attr(df, ".num_sims") <-atb$.num_sims
attr(df, "distribution_family_tpe") <-distribution_family_type
attr(df, "tibble_type") <-"tidy_bootstrap"
attr(df, "dist_with_params") <-"Empirical"return(df)
}
Example:
>tb<- tidy_bootstrap(.x=mtcars$mpg)
> bootstrap_unnest_tbl(tb)
# A tibble: 50,000 x 2sim_numbery<fct><dbl>1122.82117.33122.84119.25114.36124.47118.781219110.410121.5# ... with 49,990 more rows>> bootstrap_unnest_tbl(tb) %>%
+ tidy_distribution_summary_tbl(sim_number)
# A tibble: 2,000 x 11sim_numbermean_valmedian_valstd_valmin_valmax_valskewnesskurtosisrangeiqr<fct><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl>1119.419.25.1910.430.40.2512.87207.82219.919.25.2310.433.90.4873.6923.53.73319.318.75.1710.433.90.7614.1423.54.104420.019.75.9210.433.90.7013.3323.56.35518.418.74.6510.432.40.7624.62225.56619.217.86.2710.433.90.9513.6223.567722.219.76.4814.733.90.6821.9319.213.18820.219.26.8310.433.90.5562.5023.57.69919.517.37.1310.433.90.7472.3623.56.3101019.818.15.7210.432.40.9993.56225.9# ... with 1,990 more rows, and 1 more variable: variance <dbl>>> bootstrap_unnest_tbl(tb) %>%
+ tidy_distribution_summary_tbl()
# A tibble: 1 x 10mean_valmedian_valstd_valmin_valmax_valskewnesskurtosisrangeiqrvariance<dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl><dbl>120.119.25.9210.433.90.6412.8123.57.335.0>> mean(mtcars$mpg)
[1] 20.09062
The text was updated successfully, but these errors were encountered:
Function:
Example:
The text was updated successfully, but these errors were encountered: