binary: Work with Binary Columns

as.binaryR Documentation

Work with Binary Columns

Description

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.

Usage

as.binary(x)

is.binary(x)

try_binary(x)

Arguments

x

value(s) to convert to binary

Examples

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"))


certe-medical-epidemiology/certestats documentation built on Nov. 9, 2024, 8:15 p.m.