Learn R Programming

RevEcoR (version 0.99.2)

compose: Compose multiple functions

Description

In infix and prefix forms.

Usage

compose(...)

f %.% g

Arguments

...
n functions to apply in order from right to left
f,g
two functions to compose for the infix form

Details

This function was from hadley wickham's package pryr, for more details see https://github.com/hadley/pryr

Examples

Run this code
not_null <- `!` %.% is.null
not_null(4)
not_null(NULL)

add1 <- function(x) x + 1
compose(add1,add1)(8)

Run the code above in your browser using DataLab