Learn R Programming

radiant.data (version 1.4.5)

as_integer: Convert variable to integer avoiding potential issues with factors

Description

Convert variable to integer avoiding potential issues with factors

Usage

as_integer(x)

Value

Integer

Arguments

x

Input variable

Examples

Run this code
as_integer(rnorm(10))
as_integer(letters)
as_integer(as.factor(5:10))
as.integer(as.factor(5:10))
as_integer(c("a","b"))
as_integer(c("0","1"))
as_integer(as.factor(c("0","1")))

Run the code above in your browser using DataLab