Learn R Programming

lares (version 5.0.3)

numericalonly: Select only numerical columns in a dataframe

Description

Select only numerical columns in a dataframe

Usage

numericalonly(df, dropnacols = TRUE, logs = FALSE, natransform = NA)

Arguments

df

Data.frame

dropnacols

Boolean. Drop columns with only NA values?

logs

Boolean. Calculate log(x)+1 for numerical columns?

natransform

String. "mean" or 0 to impute NA values. If set to NA no calculation will run.

Value

data.frame with all numerical columns selected.

See Also

Other Data Wrangling: balance_data(), categ_reducer(), cleanText(), date_cuts(), date_feats(), formatNum(), holidays(), impute(), left(), normalize(), ohe_commas(), ohse(), removenacols(), removenarows(), replaceall(), textFeats(), textTokenizer(), vector2text(), year_month(), year_week()

Examples

Run this code
# NOT RUN {
data(dft) # Titanic dataset
str(dft)
numericalonly(dft) %>% head()
numericalonly(dft, natransform = "mean") %>% head()
# }

Run the code above in your browser using DataLab