Compose: Compose functions

Description Usage Arguments Examples

View source: R/functional.R

Description

Returns a function that applies the last argument to its input, than the penultimate argument and so on.

Usage

1
2
3
Compose(...)

g %.% f

Arguments

...

The functions to be composed.

fn1,fn2

Two functions to compose (infix notaion)

Examples

1
2
3
4
5
6
x <- c(1,1,2,2,3,3)
 nunique <- Compose(length, unique)
 nunique(x) == length(unique(x))

 ## usefull in lapply constructs
 sapply(mtcars, length %.% unique)

gschofl/rmisc documentation built on May 17, 2019, 8:54 a.m.