This function attempts to convert each column of a dataframe to numeric. Additionally, it replaces commas with dots to handle decimal separators.
If at any point of the conversion a Nan value is detected, where it was not present in the original column, then the original column is retained.
try_cast_as_numeric(dataframe)A dataframe with columns converted to numeric where possible.
(data.frame) A dataframe whose columns are to be converted to numeric.