Learn R Programming

datawizard (version 0.13.0)

coerce_to_numeric: Convert to Numeric (if possible)

Description

Tries to convert vector to numeric if possible (if no warnings or errors). Otherwise, leaves it as is.

Usage

coerce_to_numeric(x)

Value

Numeric vector (if possible)

Arguments

x

A vector to be converted.

Examples

Run this code
coerce_to_numeric(c("1", "2"))
coerce_to_numeric(c("1", "2", "A"))

Run the code above in your browser using DataLab