capture "->"
Dear Duncan, On Fri, Mar 1, 2024 at 11:30?AM Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
... If you parse it with srcrefs, you could look at the source. The parser doesn't record whether it was A -> B or B <- A anywhere else.
Thank you, this gets me closer but it still needs a little push:
foo <- function(x) {
x <- substitute(x) return(attr(x, "srcref")[[2]]) }
foo(A -> B)
NULL This seems to work, however:
foo({A -> B})
A -> B Is there a way to treat the formula as if it was enclosed between the curly brackets? Dmitri