Is there a way of doing the following
ex1 <- quote(iris)
ex2 <- quote(dplyr::filter(Species == "setosa" & Sepal.Width > 4))
substitute(x %>% y, list(x = ex1, y = ex2))
#> iris %>% filter(Species == "setosa" & Sepal.Width > 4)
using the base pipe instead of the magrittr pipe?
substitute(x |> y, list(x = ex1, y = ex2))
#> Error: The pipe operator requires a function call as RHS
The error message is actually quite helpful here. With the base pipe you always need parentheses on the right-hand-side. So doing
does produce a call. Then however, you will probably want to change
ex2for the call to be valid: