Description Usage Arguments Examples
Split a dataframe column into equal-sized groups.
1 | group_equal(df, col, n_groups = 5, add_first_last = TRUE)
|
df |
A dataframe |
col |
A numeric column. If the value here is outside the vector range, the 'group' colum will be set to NA for that row. |
n_groups |
Number of groups to end. |
add_first_last |
Should the first and last element be included? |
1 2 | groups <- group_equal(mtcars, "mpg", n_groups = 5)
dobtools::group_numeric(mtcars, "mpg", groups, add_first_last = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.