cleaner_conversions: Cleaner conversion functions

chrR Documentation

Cleaner conversion functions

Description

Cleaner conversion functions

convert x to arbitrary class

Usage

chr(x, ...)

int(x, ...)

dbl(x, ...)

num(x, ...)

bool(x, ...)

as.class(x, class)

Arguments

x

object to be converted

...

other args for as. conversion

class

chatracter name of the class to convert x to

Note

These are shorthand aliases for common conversions There is nothing magical here, but it can make your code more readable

Author(s)

Steven Nydick, steven.nydick@kornferry.com

Ben Wiseman, benjamin.wiseman@kornferry.com

Examples

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


foo <- 255
as.class(foo, "roman")
# [1] CCLV

roperators documentation built on July 26, 2023, 5:27 p.m.