Compose multiple functions

compose(..., .dir = c("backward", "forward"))

## Arguments

... Functions to apply in order (from right to left by default). Formulas are converted to functions in the usual way. These dots support tidy dots features. In particular, if your functions are stored in a list, you can splice that in with !!!. If "backward" (the default), the functions are called in the reverse order, from right to left, as is conventional in mathematics. If "forward", they are called from left to right.

A function

## Examples

not_null <- compose(!, is.null)
not_null(4)#> [1] TRUEnot_null(NULL)#> [1] FALSE
add1 <- function(x) x + 1
fn("input")#> [1] "input bar foo"