Counts number of elements in each bin based on given attribute for every fraction.

fracTable(
  data,
  fraction_column = "Fraction_Number",
  column_to_bin,
  finite_bin_limits,
  include_negInf = FALSE,
  include_Inf = FALSE
)

Arguments

data

Data frame with columns "column_to_bin" and "fraction_column". Every row is considered to be an unique element used for binning.

fraction_column

Column used to identify the fraction number. Default value is "Fraction_Number".

column_to_bin

Column whose values are used for binning.

finite_bin_limits

Finite delimiters between bins.

include_negInf

Include negative infinity as the lower boundary of the first bin. Defaults to FALSE.

include_Inf

Include infinity as the upper boundary of the last bin. Defaults to FALSE.

Value

A data frame with fractions as rows and bins as columns. Cells report a number of elements in a fraction with values in a bin's range. Additional columns are "NA_values", "total", "min" and "max". The last row reports total number of elements per bin.

Details

For a given "finite_bin_limits" it creates bins considering also the arguments "include_negInf" and "include_Inf". For every fraction, it counts number of non-NA elements which fall into each bin. Lower boundary of a bin is included and upper boundary is excluded. If NA values are present, their number per fraction is reported.