[ESS] send region with function call to R

Dan Davison davison at stats.ox.ac.uk
Tue Oct 20 20:51:20 CEST 2009


Wesley Chen <tjneibor at gmail.com> writes:

> This looks awesome. I will check it out later.
>
> Originally, I was looking for something similar to ess-evaluate-region, but
> rather than sending the region, it sends str("selected region/object") or
> names("selected region/object") to R. As you mentioned in your blog, I need
> to constantly inspect structures of different objects, thus I would like to
> write some lisp functions and keybinding to speed up my frequent function
> calls. Hope it makes me clearer.

Hi Wesley,

This is just a quick hack, but does this help as a starting point?

(defun ded/ess-execute-command-on-region (cmd)
  (interactive "sEnter function name: \n")
  (ess-execute
   (concat cmd "(" (buffer-substring (point) (mark)) ")")))

Dan

>
>
> On Tue, Oct 20, 2009 at 10:56 AM, Erik Iverson <erikriverson at gmail.com>wrote:
>
>> Hello,
>>
>> On Tue, Oct 20, 2009 at 12:02 PM, Wesley Chen <tjneibor at gmail.com> wrote:
>> > Dear ESS users,
>> >
>> > I am trying to write a function in .emacs to send region with function
>> call
>> > to R. For example
>> >
>> > test = rbind(c(1,2,3),c(4,5,6)) ;
>> >
>> > Then I can highlight "test" and send a function call like
>> >
>> > str(test)
>> >
>> > to R using local keybinding .
>>
>> It's hard for me tell exactly what you want, but is this what you're
>> looking for?
>>
>>
>> http://blogisticreflections.wordpress.com/2009/10/01/r-object-tooltips-in-ess/
>>
>> Full disclosure, this is a blog I run, but I think it is relevant to
>> this question.
>>
>> Best Regards,
>> Erik Iverson
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list