Designed for use with the keys_near()
function.
Examples
# Specify your own list of summaries
l_ranges <- list(min = b_min,
range_diff = b_range_diff,
max = b_max,
iqr = b_iqr)
heights %>%
key_slope(formula = height_cm ~ year) %>%
keys_near(key = country,
var = .slope_year,
funs = l_ranges)
#> # A tibble: 4 × 5
#> country .slope_year stat stat_value stat_diff
#> <chr> <dbl> <fct> <dbl> <dbl>
#> 1 Burundi 0.321 range_diff 0.424 0.102
#> 2 Burundi 0.321 max 0.321 0
#> 3 Eritrea -0.102 min -0.102 0
#> 4 Switzerland 0.0496 iqr 0.0485 0.00116