ntiles | R Documentation |
Create vector based on roughly equally sized groups
ntiles(
x,
n = 3,
format = c("rank", "interval", "mean", "median", "center", "left", "right"),
digits = 3
)
x |
a numeric vector |
n |
(approximate) number of quantiles |
format |
a specification of desired output format. One of "center", "interval", "left", "right", "mean", or "median. |
digits |
desired number of digits for labeling of factors. |
This is a functional clone of mosaic::ntiles
in order to avoid the dependency. It should be
removed in the future, when there is no need to avoid such dependency, e.g. when {mosaic}
is
available on WASM.
a vector. The type of vector will depend on format
.
CRDS |> head(20) |> mutate(group = ntiles(height, 3, format="center"))
CRDS |> head(20) |> mutate(group = ntiles(height, 3, format="interval"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.