Learn R Programming

icd (version 3.3)

logical_to_binary: Encode TRUE as 1, and FALSE as 0 (integers)

Description

When saving data as text files for distribution, printing large amounts of text containing TRUE and FALSE is inefficient. Convert to binary takes more R memory, but allows more compact output

Usage

logical_to_binary(x)

binary_to_logical(x)

Arguments

x

data.frame which may contain logical fields

Value

data.frame without logical fields

Functions

  • binary_to_logical: Convert integer columns to logical values

Examples

Run this code
# NOT RUN {
mat <- matrix(sample(c(TRUE, FALSE), size = 9, replace = TRUE), nrow = 3)
mat
icd:::logical_to_binary(mat)
icd:::binary_to_logical(icd:::logical_to_binary(mat))
# }

Run the code above in your browser using DataLab