follows: Follows

Description Usage Arguments Value Examples

Description

Syntactic sugar for composition of two functions. Useful for apply functions.

Usage

1
2
3
follows(f, g)

f %f% g

Arguments

f

a function of one argument

g

another function with range equal to the domain of f

...

additional arguments to g

Value

The function given by f follows g of x.

Examples

1
2
3
4
5
6
sqr <- function(x) x^2
min10 <- function(x) x - 10
(sqr %f% min10)(2)
div5 <- function(x) x/5
(sqr %f% min10 %f% div5)(2)
(unique %f% unlist %f% `[`)(letters[1:10], c(3, 2))

stevencarlislewalker/subscript documentation built on May 30, 2019, 4:45 p.m.