Skip to contents

This function divides the values of a specified column in a data frame into n_bins bins of equal width. The bin labels are then added as a new column in the data frame.

Usage

getBinExpression(dtf_coef, n_bins)

Arguments

dtf_coef

A data frame containing the values to be binned.

n_bins

The number of bins to create.

Value

A data frame with an additional column named binExpression, containing the bin labels.

Examples

dtf <- data.frame(mu_ij = c(10, 20, 30, 15, 25, 35, 40, 5, 12, 22))
dtf_with_bins <- getBinExpression(dtf, n_bins = 3)