View source: R/standalone-tidy-utils.R
cut_integer | R Documentation |
Deals with some annoying issues classifying integer data sets, such as ages, into groups. where you want to specify just the change over points as integers and clearly label the resulting ordered factor.
cut_integer(
x,
cut_points,
glue = "{label}",
lower_limit = -Inf,
upper_limit = Inf,
...
)
x |
a vector of integer valued numbers, e.g. ages, counts |
cut_points |
a vector of integer valued cut points which define the lower boundaries of conditions |
glue |
a glue spec that may be used to generate a label. It can use {low}, {high}, {next_low}, or {label} as values. |
lower_limit |
the minimum value we should include (this is inclusive for the bottom category) (default -Inf) |
upper_limit |
the maximum value we should include (this is also inclusive for the top category) (default Inf) |
... |
not used |
an ordered factor of the integer
cut_integer(stats::rbinom(20,20,0.5), c(5,10,15))
cut_integer(floor(stats::runif(100,-10,10)), cut_points = c(2,3,4,6), lower_limit=0, upper_limit=10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.