From dm|tr|@pop@venko @end|ng |rom gm@||@com  Fri Mar  1 11:25:09 2024
From: dm|tr|@pop@venko @end|ng |rom gm@||@com (Dmitri Popavenko)
Date: Fri, 1 Mar 2024 12:25:09 +0200
Subject: [Rd] capture "->"
In-Reply-To: <ff87b48a-ccad-40ec-b79e-3fb4c945d3a9@gmail.com>
References: <CAJL_pojF-Qc8YA0_eB+Ab9w3qD5sgMkjm0C3b0ooOmoOUy769w@mail.gmail.com>
 <ff87b48a-ccad-40ec-b79e-3fb4c945d3a9@gmail.com>
Message-ID: <CAJL_pogbYhhLxsXQN0jjm83sZybh1nO1wE6F+CwNV18F9EkYUA@mail.gmail.com>

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

	[[alternative HTML version deleted]]



[Rd] capture "->"
Dmitri Popavenko