Converts a data.table column from continuous to a discrete factor

discretize_variable(data, variable, num_cats, breakpoints = NULL)

Arguments

data

data.table, containing the column to change

variable

character, the name of the column to change

num_cats

integer, the number of bins to generate

breakpoints

numeric vector, the breakpoints to use. If NULL, these will be quantiles.

Value

the updated data.table, modified in place