cut_evenly.Rd
This function work very well in combination with percentify_cut
to create evenly spaced intervals.
cut_evenly(n)
n | number of points |
---|
numeric vector of length n-1.
cut_evenly(3)#> [1] 0.3333333 0.6666667cut_evenly(4)#> [1] 0.25 0.50 0.75cut_evenly(9)#> [1] 0.1111111 0.2222222 0.3333333 0.4444444 0.5555556 0.6666667 0.7777778 #> [8] 0.8888889library(dplyr) # cut_evenly() is primarily used along with percentify_cut() to space the # cuts easily. percentify_cut(mtcars, mpg, cut_evenly(4)) %>% summarise(mean(wt))#> # A tibble: 4 x 2 #> .percentile_mpg `mean(wt)` #> <chr> <dbl> #> 1 0%-25% 4.28 #> 2 25%-50% 3.57 #> 3 50%-75% 2.95 #> 4 75%-100% 2.21