set_bins_df: given a set of bin ranges, assign each value to a bin and...

Description Usage Arguments Details See Also

View source: R/set_bins_df.R

Description

given a set of bin ranges, assign each value to a bin and provide the label

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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
)

Arguments

.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

Details

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

See Also

set_bins


PKPDmisc documentation built on April 14, 2020, 5:49 p.m.