Skip to contents

This function attempts to make all or certain variables numeric. If a warning or error is thrown, the variable is kept as is.

Usage

make_numeric_if_possible(df, vars = NULL)

Arguments

df

data.frame

vars

(character) variable names to make numeric (if NULL, all variables)

Value

df with vars cast into numeric when possible

Examples

df <- df |> make_numeric_if_possible()