Learn R Programming

radiant.data (version 1.0.6)

as_numeric: Convert variable to numeric avoiding potential issues with factors

Description

Convert variable to numeric avoiding potential issues with factors

Usage

as_numeric(x)

Arguments

x

Input variable

Value

Numeric

Examples

Run this code
# NOT RUN {
as_numeric(rnorm(10))
as_numeric(letters)
as_numeric(as.factor(5:10))
as.numeric(as.factor(5:10))
as_numeric(c("a","b"))
as_numeric(c("3","4"))

# }

Run the code above in your browser using DataLab