convert_df_to_categoric: Convert every column in a data frame to character

convert_df_to_categoricR Documentation

Convert every column in a data frame to character

Description

It converts all the variables present in 'data' to character. Criteria conversion is based on two functions, discretize_get_bins plus discretize_df, which will discretize all the numerical variables based on equal frequency criteria, with the number of bins equal to 'n_bins'. This only applies for numerical variables which unique valuesare more than 'n_bins' parameter. After this step, it may happen that variables remain non-character, so these variables will be converting directly into character.

Usage

convert_df_to_categoric(data, n_bins)

Arguments

data

input data frame to discretize

n_bins

number of bins/segments for each variable

Value

data frame containing all variables as character

Examples


# before
df_status(heart_disease)

# after
new_df=convert_df_to_categoric(data=heart_disease, n_bins=5)
df_status(new_df)


funModeling documentation built on May 29, 2024, 3:24 a.m.