Skip to contents

This function will return a tibble that can either be nested/unnested, and grouped or un-grouped. The .data argument must be the output of the hai_distribution_comparison_tbl() function.

Usage

hai_get_density_data_tbl(.data, .unnest = TRUE, .group_data = TRUE)

Arguments

.data

The data from the hai_distribution_comparison_tbl() function as this function looks for an attribute of hai_dist_compare_tbl

.unnest

Should the resulting tibble be un-nested, a Boolean value TRUE/FALSE. The default is TRUE

.group_data

Should the resulting tibble be grouped, a Boolean value TRUE/FALSE. The default is FALSE

Value

A tibble.

Details

This function expects to take the output of the hai_distribution_comparison_tbl() function. It returns a tibble of the tidy density data.

See also

Other Distribution Functions: hai_distribution_comparison_tbl(), hai_get_dist_data_tbl()

Author

Steven P. Sanderson II, MPH

Examples

library(dplyr)

df <- hai_scale_zero_one_vec(.x = mtcars$mpg) %>%
  hai_distribution_comparison_tbl()
hai_get_density_data_tbl(df)
#> # A tibble: 1,536 × 3
#> # Groups:   distribution [3]
#>    distribution      x       y
#>    <chr>         <dbl>   <dbl>
#>  1 gamma        -0.395 0.00670
#>  2 gamma        -0.391 0.00741
#>  3 gamma        -0.387 0.00819
#>  4 gamma        -0.383 0.00903
#>  5 gamma        -0.378 0.00996
#>  6 gamma        -0.374 0.0110 
#>  7 gamma        -0.370 0.0121 
#>  8 gamma        -0.366 0.0133 
#>  9 gamma        -0.362 0.0146 
#> 10 gamma        -0.357 0.0160 
#> # ℹ 1,526 more rows