Boolean (logical) operations on vectors



examples/vectors/boolean_vectors_truth_table.R
a = c(TRUE, TRUE, FALSE, FALSE)
b = c(TRUE, FALSE, TRUE, FALSE)
sum(a)
sum(b)  # number of TRUE items

a & b
a | b
! a

examples/vectors/boolean.R
a = c(TRUE, TRUE, FALSE, TRUE)
b = c(TRUE, FALSE, TRUE, FALSE)
c = c(TRUE, FALSE, FALSE, TRUE)

a & b
a | b
! a

# operator precedence
# the use of parentheses

a & (b | c)