discretizeData: Discretize numerical variables in a dataset

View source: R/discretizeData.R

discretizeDataR Documentation

Discretize numerical variables in a dataset

Description

This function discretizes all numerical variables, or only the ones passed in features, into K categories based on their quantiles. Names of categories can optionally be given in knames.

Usage

discretizeData(
  data,
  K = 2,
  features = NULL,
  knames = NULL,
  return_split = FALSE
)

Arguments

data

data to discretize.

K

numeric, number of categories (default: K = 2).

features

vector with variables names or column numbers to discretize. If NULL (default), then all numeric variables are discretized.

knames

optional: character vector of the same length than K, containing the ordered names for categories.

return_split

if TRUE, then the table with thresholds used to discretize data is also returned.

Value

Data with discretized variables.


leylabmpi/endoR documentation built on Oct. 20, 2023, 10:53 p.m.