quantify: Count the number of times an iterable object is TRUE

Description Usage Arguments Value Examples

View source: R/quantify.r

Description

Returns the number of elements from an iterable object evaluate to TRUE.

Usage

1
quantify(object)

Arguments

object

an iterable object

Value

the number of TRUE elements

Examples

1
2
3
4
5
6
it <- iterators::iter(c(TRUE, FALSE, TRUE))
quantify(it) # 2

set.seed(42)
x <- sample(c(TRUE, FALSE), size=10, replace=TRUE)
quantify(x) # Equivalent to sum(x)

itertools2 documentation built on May 30, 2017, 7:17 a.m.