Learn R Programming

datawizard (version 0.4.0)

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

to_numeric(x)

Arguments

x

A vector to be converted.

Value

Numeric vector (if possible)

Examples

Run this code
# NOT RUN {
to_numeric(c("1", "2"))
to_numeric(c("1", "2", "A"))
# }

Run the code above in your browser using DataLab