cut_interval.fun | R Documentation |
This Wrappers creates partial functions with x as sole argument of the ggplot2 cut functions
cut_interval.fun(n = NULL, length = NULL, ...)
cut_number.fun(n = NULL, ...)
cut_width.fun(
width,
center = NULL,
boundary = NULL,
closed = c("right", "left"),
...
)
n |
number of intervals to create, OR |
length |
length of each interval |
... |
Arguments passed on to
|
width |
The bin width. |
center , boundary |
Specify either the position of edge or the center of a bin. Since all bins are aligned, specifying the position of a single bin (which doesn't need to be in the range of the data) affects the location of all bins. If not specified, uses the "tile layers algorithm", and sets the boundary to half of the binwidth. To center on integers, |
closed |
One of |
function
ggplot2::cut_interval()
ggplot2::cut_number()
ggplot2::cut_width()
data <- tibble::tibble(x = runif(100, 0, 10))
funs <- list(
interval = cut_interval.fun(n = 5),
number = cut_number.fun(n = 5),
width = cut_width.fun(width = 2, boundary = 0)
)
res <- dplyr::mutate_all(tibble::tibble(x = runif(100, 0, 10)), funs)
res
table(res$interval)
table(res$number)
table(res$width)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.