discretize_numbers | R Documentation |
Discretize continuous numbers
discretize_numbers(x, min_size = 1, ...)
x |
vector of numbers. |
min_size |
minimum size of bins at the edges. Any bins smaller than this size are combined. |
... |
Arguments passed on to
|
The function get_breaks
is called to create the boundaries between groups.
It is called on default with limits = range(x)
and with include_bounds = FALSE
.
This behaviour may be overridden with the ...
argument, although it is advised not to do so to avoid empty groups.
NA
values are preserved in the result.
A factor with the same length as x
, with labels indicating bins.
ages = round(rnorm(1000,50,10)); ages[1] = NA discretize_numbers(ages)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.