introspection
ggrothendieck opened this issue · comments
ggrothendieck commented
(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
## .
Lionel Henry commented
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.
Lionel Henry commented
Closing this for the reasons mentioned above, but thanks for the suggestions!