Negate: Negate a function; borrowed from src/library/base/R/funprog.R...

Description Usage Arguments Value Examples

View source: R/functional.R

Description

Negate a function; borrowed from src/library/base/R/funprog.R for pre-2.7 Rs.

Usage

1
Negate(f)

Arguments

f

the function to be negated

Value

The negated function

Examples

1
2
3
is.even <- function(a) a%%2 == 0
is.odd <- Negate(is.even)
stopifnot(Reduce(`&&`, Map(is.odd, c(1, 3, 5))))

klutometis/R-functional documentation built on May 20, 2019, 12:37 p.m.