Learn R Programming

SerolyzeR (version 1.3.1)

try_cast_as_numeric: Try cast dataframe columns as numeric

Description

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.

Usage

try_cast_as_numeric(dataframe)

Value

A dataframe with columns converted to numeric where possible.

Arguments

dataframe

(data.frame) A dataframe whose columns are to be converted to numeric.