Description Usage Arguments Details Value See Also Examples
percentify()
is the main function in percentify. It takes a data.frame or
tibble, and creates groups based on the quantiles lower and upper bounds
specified. This become handy once you start working with multiple
overlapping bounds.
1 2 3 | autoplot.percentiled_df(object)
percentify(data, var, lower = 0, upper = 1, key = ".percentile")
|
object |
The |
data |
A data.frame or tibble, |
var |
Variable to do grouping by as string or symbol. |
lower |
Numerical values for lower bound of ranges. Must be between 0 and 1. Length of lower and upper must be equal. |
upper |
Numerical values for upper bound of ranges. Must be between 0 and 1. Length of lower and upper must be equal. |
key |
A single character specifying the name of the virtual group that is added. Defaults to ".percentile". |
There is a ggplot2::autoplot()
to visualize the the percentile ranges.
percentile grouped tibble
Other percentile samplers: percentify_cut
,
percentify_max
,
percentify_min
,
percentify_random
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | library(dplyr)
library(broom)
percent_mtcars <- percentify(mtcars, mpg,
lower = c(0.2, 0.4),
upper = c(0.6, 0.8)
)
percent_mtcars
summarize(percent_mtcars,
mean_hp = mean(hp),
mean_wt = mean(wt),
n_obs = n()
)
percent_mtcars %>%
group_modify(~tidy(lm(disp ~ wt + cyl, data = .x)))
library(ggplot2)
autoplot(percent_mtcars)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.