%>>% {lumberjack}R Documentation

The lumberjack operator

Description

The not-a-pipe operator that tracks changes in data.

Usage

lhs %>>% rhs

lhs %L>% rhs

Arguments

lhs

Input value

rhs

Function call or 'dotted' expression (see below). as value

Piping

The operators %L>% and %>>% are synonyms. The %L>% is the default since version 0.3.0 to avoid confusion with the %>>% operator of the pipeR package but %>>% still works.

The lumberjack operator behaves as a simplified version of the magrittr pipe operator. The basic behavior of lhs %>>% rhs is the following:

The most notable differences with 'magrittr' are the following.

Logging

If the left-hand-side is tagged for logging, the lumberjack will update the log by calling the logger's $add() method, with arguments meta, input, output. Here, meta is a list with information on the operations performed, and input and output are the left-hand-side and the result, respectively.

See Also

Other control: dump_log(), get_log(), run_file(), start_log(), stop_log()

Examples

# pass arguments to a function
1:3 %L>% mean()

# pass arguments using "."
TRUE %L>% mean(c(1,NA,3), na.rm = .)

# pass arguments to an expression, using "."
1:3 %L>% { 3 * .}

# in a more complicated expression, return "." explicitly
women %L>% { .$height <- 2*.$height; . }




[Package lumberjack version 1.3.1 Index]