compose {dostats}R Documentation

Nest functions

Description

Nest functions

Usage

compose(..., .list)

x %.% y

Arguments

...

functions to be nested together

.list

alternatively an explicit list of functions. If specified ... will be ignored.

x

a function

y

a function

Details

compose creates a functional composition of the listed functions. Functional composition of functions f and g is defined as f(g(.)). Order matters the right most function listed will be the innermost function in the composition, same with the operator version. To remember the order lists will be the order read out, i.e. compose(f,g) = f(g(x))

When using the operator version it is good to remember that parentheses are recommended see the examples

Value

new function consisting of the functions nested

Functions

Author(s)

Andrew Redd

Examples

compose(any, is.na)(c(NA,1:3))
(sum%.%is.na)(c(1,NA))  #correct
## Not run: 
sum%.%is.an(NA)  #incorrect

## End(Not run)

[Package dostats version 1.3.3 Index]