as.binary | R Documentation |
Transform logicals and numerics to a new class 'binary'. The function try_binary()
only coerces to binary
if the input is numeric and consists of only zeroes and ones.
as.binary(x)
is.binary(x)
try_binary(x)
x |
value(s) to convert to |
as.binary(c(TRUE, FALSE))
as.binary(c(1, 0))
as.binary(c(1, 0)) + 3 # not binary anymore
try_binary(c(0, 1))
try_binary(c(2, 3))
try_binary(c("a", "b"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.