[ESS] Feature idea: insert expression before <- at point

Michael Lawrence |@wrence@m|ch@e| @end|ng |rom gene@com
Tue Apr 30 21:52:39 CEST 2019


+1, good idea.

In some ways this is the edit-time equivalent of the pipe operator and its
back reference ".", which can place cognitive burden on the reader.

You give examples of replacement. Repetition also arises in extraction,
e.g., with [().

data[,"columnA"][_POINT_ > 10]

One concern is that this might discourage semantic labeling of expressions
through assignment (a problem shared with the pipe).

On Tue, Apr 30, 2019 at 11:25 AM Sven Hartenstein via ESS-help <
ess-help using r-project.org> wrote:

> Dear ESS users and developers,
>
> when writing R code to manipulate an object or data frame column, I
> often find myself retyping the expression on the left side of "<-" as
> some argument for a function call or assignment on the right side of
> "<-".
>
> Here are two examples. Imagine your point is at _POINT_ and you want to
> insert 'data[,"columnA"]' in the first example and in the second example
> 'data[ data[,"columnB"] < 123 ,"columnA"]' at point.
>
> data[,"columnA"] <- tolower(_POINT_)
>
> data[ data[,"columnB"] > 123 ,"columnA"] <- gsub("xxx",
>                                                   "yyy",
>                                                   _POINT_,
>                                                   fixed=TRUE)
>
> Wouldn't it be handy to have a lisp function which copies the expression
> on the left side of "<-" and inserts it at point?
>
> Or is something like this already available in ESS?
>
> Or is my coding process unusual and you are not in the situation to use
> such a function?
>
> What do you think?
>
> (I am not very familiar with lisp and thus do not try to write such a
> function. I might use a macro.)
>
> Thanks,
>
> Sven
>
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

	[[alternative HTML version deleted]]



More information about the ESS-help mailing list