bin_vector | R Documentation |
bin a numeric vector and return a factor of bins
bin_vector(numeric_vector, breaks = 10, binLabels = NULL, return_df = TRUE)
numeric_vector |
|
breaks |
either a single number specifying the number of equally widthed breaks, or a vector of break boundaries |
binLabels |
optional labels for the new bins that are returned instead of the bin range |
return_df |
return a data.frame with boundaries, the value and the bin level |
vec = sample(1:100, size = 100)
bin_vector(vec, breaks = 10)
bin_vector(vec, breaks = c(0, 33, 66, 100))
bin_vector(vec, breaks = c(0, 33, 66, 100),
binLabels = c('lower tertile', 'middle tertile', 'upper tertile'),
return_df = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.