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

Sven Hartenstein ||@t@ @end|ng |rom @venh@rten@te|n@de
Tue Apr 30 20:25:21 CEST 2019


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



More information about the ESS-help mailing list