and: Robust 'and' operator working with truthy and falsy values.

Description Usage Arguments Examples

Description

Robust 'and' operator working with truthy and falsy values.

Usage

1
lhs %&&% rhs

Arguments

lhs

Left hand side, always evaluated.

rhs

Right hand side, evaluated only if lhs evaluates to TRUTHY.

Examples

1
2
3
4
5
6
7
8
9
## Shift to zero
v <- 5:10
v %&&% { v <- v - min(v) }
v

## It works if the vector is empty
v <- numeric()
v %&&% { v <- v - min(v) }
v

gaborcsardi/falsy documentation built on May 16, 2019, 4:09 p.m.