set_bins_df | R Documentation |
given a set of bin ranges, assign each value to a bin and provide the label
set_bins_df( .df, .x, breaks = stats::quantile(.df[[.x]], na.rm = T), .name = NULL, .label = NULL, lower_bound = -Inf, upper_bound = Inf, quiet = TRUE, between = NULL, inclusive = TRUE )
.df |
data frame |
.x |
name of column |
breaks |
breaks for each bin, defaults to quantiles |
.name |
name of new binned column, defaults to appending _bin to column name |
.label |
name of the new label column, defaults to appending _label to bin column name |
lower_bound |
set a lower bound for the first bin, defaults to -Inf |
upper_bound |
set an upper bound for the last bind, defaults to Inf |
quiet |
whether to give additonal information regarding bins and assigned range for each |
between |
defaults to NULL, a special case of setting all inside the specified range |
inclusive |
include max value of largest user defined bin even though lower bins are non-inclusive |
set_bins_df offers the ability to create bins from a dataframe and get both the binning column as well as a label column with the range of values associated with a given bin
set_bins
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.