logical_to_binary: Convert logical columns of data frame to 0s and 1s

Description Usage Arguments Value Examples

View source: R/logical_to_binary.r

Description

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

Usage

1
2
3

Arguments

x

data frame which may contain logical fields

Value

data frame without logical fields

Examples

1
2
3
4
5
6
7
d <- data.frame(
  a = c(TRUE, FALSE, TRUE),
  b = c(FALSE, TRUE, FALSE),
  c = c(-1, 0, 1),
  d = c("not", "logical", "values")
)
logical_to_binary(d)

Example output

  a b  c       d
1 1 0 -1     not
2 0 1  0 logical
3 1 0  1  values

jwutil documentation built on May 7, 2019, 1:03 a.m.