Learn R Programming

modelbased (version 0.6.0)

as.numeric_ifnumeric: Convert to Numeric if Possible

Description

Tries to convert vector to numeric if possible. Otherwise, leaves it as is.

Usage

as.numeric_ifnumeric(x)

Arguments

x

A vector to be converted.

Value

Numeric

Examples

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

Run the code above in your browser using DataLab