View source: R/doRegroupings.R
groupByBreaks | R Documentation |
Group values together that belong to the same intervals being defined by breaks
groupByBreaks( x, breaks, values = breaksToIntervalLabels(breaks), right = TRUE, add.Inf.limits = TRUE, to.factor = FALSE, columns = NULL, keyFields = NULL )
x |
vector of values or a data frame. If |
breaks |
vector of breaks |
values |
values to be assigned |
right |
if TRUE the intervals are right-closed, else left-closed. |
add.Inf.limits |
if TRUE (default), -Inf and Inf are added to the left
and right, respectively, of |
to.factor |
if |
columns |
|
keyFields |
|
groupByBreaks(1:10, breaks = 5, values = c("<= 5", "> 5")) groupByBreaks(1:10, breaks = 5, right = FALSE, values = c("< 5", ">= 5")) # Prepare a simple data frame x <- kwb.utils::noFactorDataFrame( id = c("A", "B", "C"), value = c(10, 20, 30) ) # Keep the ID column of the data frame groupByBreaks(x, breaks = 20, keyFields = "id")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.