Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tee

Tee pipe


Description

Pipe a value forward into a function- or call expression and return the original value instead of the result. This is useful when an expression is used for its side-effect, say plotting or printing.

Usage

lhs %T>% rhs

Arguments

lhs

A value or the magrittr placeholder.

rhs

A function call using the magrittr semantics.

Details

The tee pipe works like %>%, except the return value is lhs itself, and not the result of rhs function/expression.

See Also

Examples

rnorm(200) %>%
matrix(ncol = 2) %T>%
plot %>% # plot usually does not return anything. 
colSums

magrittr

A Forward-Pipe Operator for R

v2.0.1
MIT + file LICENSE
Authors
Stefan Milton Bache [aut, cph] (Original author and creator of magrittr), Hadley Wickham [aut], Lionel Henry [cre], RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.