Exercise 4-6
cumsum(x)
andcumsum(!x)
can be used to test if any ‘x’ isTRUE
orFALSE
cumprod(x)
andcumprod(!x)
can be used to test if any ‘x’ isTRUE
orFALSE
In each case, the logical elements are automatically coerced into zeroes and ones.
Does this use of cumsum(), etc. have any practical use vs. using
isTrue(x)
orTRUE %in% x
, etc?