grapes (version 1.0.0)

grow: Function

Description

Turn a collection of functions into binary operators. For example, create the binary operator %cbind% from the function cbind() by calling grow(cbind). Then, you can call sleep %cbind% sleep %cbind% sleep to add to the columns of a data frame while avoiding cumbersome parentheses.

Usage

grow(..., list = character(0), from = parent.frame(), to = parent.frame())

Arguments

...
characters or symbols, names of functions to make into binary operators.
list
character vector of names of functions to make into binary operators
from
package (character scalar) or environment to look for functions to turn into binary operators.
to
environment to store the new binary operators.

Examples

Run this code
grow(rbind, from = "base") # Use `from` to specify a package or environment to search.
nrow(sleep) # 20
longer = sleep %rbind% sleep %rbind% sleep # No clumsy parentheses!
nrow(longer) # 60. Most of us would like to sleep longer.

Run the code above in your browser using DataCamp Workspace