chr | R Documentation |
Cleaner conversion functions
convert x to arbitrary class
chr(x, ...)
int(x, ...)
dbl(x, ...)
num(x, ...)
bool(x, ...)
as.class(x, class)
x |
object to be converted |
... |
other args for as. conversion |
class |
chatracter name of the class to convert x to |
These are shorthand aliases for common conversions There is nothing magical here, but it can make your code more readable
Steven Nydick, steven.nydick@kornferry.com
Ben Wiseman, benjamin.wiseman@kornferry.com
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.