Learn R Programming

radiant.data (version 0.6.0)

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
as_numeric(rnorm(10))
as_numeric(letters)
as_numeric(5:10 %>% as.factor)
as.numeric(5:10 %>% as.factor)
as_numeric(c("1","2"))

Run the code above in your browser using DataLab