Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Negate

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


Description

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

Usage

Negate(f)

Arguments

f

the function to be negated

Value

The negated function

Examples

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

functional

Curry, Compose, and other higher-order functions

v0.6
GPL (>= 2)
Authors
Peter Danenberg <pcd@roxygen.org>
Initial release
2014-07-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.