Learn R Programming

roperators (version 1.1.0)

chr: Cleaner conversion functions

Description

Cleaner conversion functions

Usage

chr(x, ...)

int(x, ...)

dbl(x, ...)

num(x, ...)

bool(x, ...)

Arguments

x

Value to be converted

...

other args for as. conversion

# Shorthand aliases for common conversions # Nothing magical here, but it can make your code more readable

chr(42) # "42" = as.character int(42.1) # 42L = as.integer dbl("42L") # 42.0 = as.double num("42") # 42 = as.numeric bool(42) # TRUE = as.logical