comps_bins | R Documentation |
Bin a vector of data into distinct groups, this is often helpful for grouping ages or lengths into bin categories if every year or centimeter is not its own bin.
comps_bins(
vector,
breaks,
includeplusgroup = TRUE,
returnclass = c("character", "numeric")
)
vector |
A vector of information that will be manipulated. |
breaks |
A vector of cut points to be passed to cut. |
includeplusgroup |
A logical defining if you want all values
larger than the largest |
returnclass |
The |
Kelli F. Johnson
comps_bins(1:8, breaks = c(-Inf, 3:5))
comps_bins(1:8, breaks = c(3:5), includeplusgroup = FALSE)
testthat::expect_equal(
comps_bins(1:8, breaks = c(-Inf, 3:5, Inf)),
comps_bins(1:8, breaks = c(-Inf, 3:5), includeplusgroup = TRUE)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.