tidyverse / magrittr

Improve the readability of R code with the pipe

Home Page:https://magrittr.tidyverse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

introspection

ggrothendieck opened this issue · comments

(1) Would be nice to have a function to determine if current function was called by a pipe.

f <- function(x) called_by_pipe()
BOD %>% f
## [1] TRUE

(2) Also a version of substitute that works in a pipe to get the name of the LHS -- something easier to use than having to walk the call stack.

This works

BOD %>% substitute
## BOD

but this gives dot at the result

f <- function(x) substitute(x)
BOD %>% f
## .

We've deliberately refrained from adding introspection to %>%.

Regarding a version that works with substitute(), we now have |>.

Also please note that magrittr is mostly in maintenance mode.

Closing this for the reasons mentioned above, but thanks for the suggestions!