R and ViM

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

R and ViM

Michael Graber-2
Dear all,

I'm starting to learn R, but I'm already programing for a while, using
ViM as editor. Therefore I'd like to be able to use R together with
ViM.

My question now is, whether there are already people out there knowing
how to do this in a similar easy way as with Emacs, and if those would
be willing to share this knowledge.
I did already research on the web on this topic, but i couldn't find
satisfying answers, except one good looking approach on the ViM-website
with a perl-script called funnel.pl, which I couldn't make running on
my mac OSX 10.3.9 so far.

I'd be grateful for help.

Thanks,
Michael Graber

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Sundar Dorai-Raj


Michael Graber wrote:

> Dear all,
>
> I'm starting to learn R, but I'm already programing for a while, using
> ViM as editor. Therefore I'd like to be able to use R together with
> ViM.
>
> My question now is, whether there are already people out there knowing
> how to do this in a similar easy way as with Emacs, and if those would
> be willing to share this knowledge.
> I did already research on the web on this topic, but i couldn't find
> satisfying answers, except one good looking approach on the ViM-website
> with a perl-script called funnel.pl, which I couldn't make running on
> my mac OSX 10.3.9 so far.
>
> I'd be grateful for help.
>
> Thanks,
> Michael Graber
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Try RSiteSearch('vim editor') at the R prompt. I got 28 hits.

HTH,

--sundar

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Ted.Harding
On 18-Apr-06 Sundar Dorai-Raj wrote:

> Michael Graber wrote:
>> I'm starting to learn R, but I'm already programing for
>> a while, using ViM as editor. Therefore I'd like to be
>> able to use R together with ViM.
>> [...]
>
> Try RSiteSearch('vim editor') at the R prompt. I got 28 hits.
>
> HTH,
>
> --sundar

And, out of interest (being a vim addict), I did that, getting

  > RSiteSearch('vim editor')
  A search query has been submitted to http://search.r-project.org
  The results page should open in your browser shortly

which it duly did. However -- and this is what's interesting --
I entered the command in R running on my machine B, at which
I'm sitting.

This machine B is independently displaying the Firefox browser
running on Machine C (via X Windows; Linux on both machines).

And that's the browser where the search results appeared.

So R running on B can hijack Firefox on C. How does it know?

Hmmm ...
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 18-Apr-06                                       Time: 17:24:22
------------------------------ XFMail ------------------------------

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Martin Maechler
In reply to this post by Sundar Dorai-Raj
>>>>> "Sundar" == Sundar Dorai-Raj <[hidden email]>
>>>>>     on Tue, 18 Apr 2006 10:43:30 -0500 writes:

    Sundar> Michael Graber wrote:
    >> Dear all,
    >>
    >> I'm starting to learn R, but I'm already programing for a
    >> while, using ViM as editor. Therefore I'd like to be able
    >> to use R together with ViM.
    >>
    >> My question now is, whether there are already people out
    >> there knowing how to do this in a similar easy way as
    >> with Emacs, and if those would be willing to share this
    >> knowledge.  I did already research on the web on this
    >> topic, but i couldn't find satisfying answers, except one
    >> good looking approach on the ViM-website with a
    >> perl-script called funnel.pl, which I couldn't make
    >> running on my mac OSX 10.3.9 so far.
    >>
    >> I'd be grateful for help.
    >>
    >> Thanks, Michael Graber
    >>
    >> ______________________________________________
    >> [hidden email] mailing list
    >> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
    >> read the posting guide!
    >> http://www.R-project.org/posting-guide.html

    Sundar> Try RSiteSearch('vim editor') at the R prompt. I got
    Sundar> 28 hits.

yeah, sure. But did you look at them?
I only browsed them quickly, but many don't seem to be relevant,
and the few that *seemed* to be relevant, mentioned the Sciviews
web page on "Editors for R"
  http://www.sciviews.org/_rgui/projects/Editors.html
and that has one line for 'vim' which gives a link that goes to
a "vimscript" page that gives the above mentioned 'funnel.pl' ..

So, I think Michael is still looking for more useful hints...

Martin Maechler, ETH Zurich

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Gabor Grothendieck
In reply to this post by Michael Graber-2
This was just posted this week:

https://www.stat.math.ethz.ch/pipermail/r-help/2006-April/092457.html

and I think there are some relevant macros on the vim web page
I use vim but do not use anything special with it.  It gives syntax
highlighting out of the box.

On 4/18/06, Michael Graber <[hidden email]> wrote:

> Dear all,
>
> I'm starting to learn R, but I'm already programing for a while, using
> ViM as editor. Therefore I'd like to be able to use R together with
> ViM.
>
> My question now is, whether there are already people out there knowing
> how to do this in a similar easy way as with Emacs, and if those would
> be willing to share this knowledge.
> I did already research on the web on this topic, but i couldn't find
> satisfying answers, except one good looking approach on the ViM-website
> with a perl-script called funnel.pl, which I couldn't make running on
> my mac OSX 10.3.9 so far.
>
> I'd be grateful for help.
>
> Thanks,
> Michael Graber
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Prof Brian Ripley
In reply to this post by Ted.Harding
yOn Tue, 18 Apr 2006, [hidden email] wrote:

> On 18-Apr-06 Sundar Dorai-Raj wrote:
>> Michael Graber wrote:
>>> I'm starting to learn R, but I'm already programing for
>>> a while, using ViM as editor. Therefore I'd like to be
>>> able to use R together with ViM.
>>> [...]
>>
>> Try RSiteSearch('vim editor') at the R prompt. I got 28 hits.
>>
>> HTH,
>>
>> --sundar
>
> And, out of interest (being a vim addict), I did that, getting
>
>  > RSiteSearch('vim editor')
>  A search query has been submitted to http://search.r-project.org
>  The results page should open in your browser shortly
>
> which it duly did. However -- and this is what's interesting --
> I entered the command in R running on my machine B, at which
> I'm sitting.
>
> This machine B is independently displaying the Firefox browser
> running on Machine C (via X Windows; Linux on both machines).
>
> And that's the browser where the search results appeared.
>
> So R running on B can hijack Firefox on C. How does it know?

?browseURL


--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Ted.Harding
On 18-Apr-06 Prof Brian Ripley wrote:

>>  [...]
>>  > RSiteSearch('vim editor')
>>  A search query has been submitted to http://search.r-project.org
>>  The results page should open in your browser shortly
>>
>> which it duly did. However -- and this is what's interesting --
>> I entered the command in R running on my machine B, at which
>> I'm sitting.
>>
>> This machine B is independently displaying the Firefox browser
>> running on Machine C (via X Windows; Linux on both machines).
>>
>> And that's the browser where the search results appeared.
>>
>> So R running on B can hijack Firefox on C. How does it know?
>
> ?browseURL

Wow! Wonders never cease! (Still unsure about the underlying
mechanism, but then X can be a hall of mirrors to the uninitiated).

Thanks for the hint!
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Fax-to-email: +44 (0)870 094 0861
Date: 18-Apr-06                                       Time: 18:26:30
------------------------------ XFMail ------------------------------

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Peter Dalgaard
(Ted Harding) <[hidden email]> writes:

> On 18-Apr-06 Prof Brian Ripley wrote:
> >>  [...]
> >>  > RSiteSearch('vim editor')
> >>  A search query has been submitted to http://search.r-project.org
> >>  The results page should open in your browser shortly
> >>
> >> which it duly did. However -- and this is what's interesting --
> >> I entered the command in R running on my machine B, at which
> >> I'm sitting.
> >>
> >> This machine B is independently displaying the Firefox browser
> >> running on Machine C (via X Windows; Linux on both machines).
> >>
> >> And that's the browser where the search results appeared.
> >>
> >> So R running on B can hijack Firefox on C. How does it know?
> >
> > ?browseURL
>
> Wow! Wonders never cease! (Still unsure about the underlying
> mechanism, but then X can be a hall of mirrors to the uninitiated).
>
> Thanks for the hint!
> Ted.

Actually, I think this belongs in a group of _mis_features in the
current user interface landscape, along with saved sessions & the
like. It sounds smart, right until you want to view a file on machine
B, say file://foo, which machine C and hence Firefox has no knowledge
about. You then realize that the only way you are going to view that
file is to shut down Firefox on C and start a new one on B. Attempting
to start one on B, as in "firefox file://foo" will just send a message
to the one on C telling it to display file://foo...

I usually get bitten by this in the reverse situation: remote login to
work machine, run R, do help.start(), and "Firefox can't find the file
at /tmp/RtmpZVbVef/.R/doc/html/index.html".

It sort of indicates missing perspective on the part of the
developers: They have forgotten about the fact that browsers might be
used for information *not* on the Internet.

(SAS tries to get around the problem of non-local access to its help
pages by setting up a local HTTP server, only to be foiled by
firewalling...)

--
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

urlwolf
In reply to this post by Michael Graber-2
Hmm, how timely.

I posted yesterday my solution to integrate R and vim. The message is
in my sent box but I don't think it showed up in the list... Here it
is again:

Hi All,

If you use vim to edit R code, you may be interested in this.
I have put together a personalized syntax file, some code templates,
and a way to send code from Vim to R using autoHotKeys (windows).

http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html

Actually, the little autoHotKeys can be useful even if you don't use
vim just to send the example R code from the help pages to the
console.

Best wishes,
-Jose

PS:
@list moderators
Any idea why my message (from a @gmail account) appeared in the sent
box but never on the list?

On 4/18/06, Michael Graber <[hidden email]> wrote:

> Dear all,
>
> I'm starting to learn R, but I'm already programing for a while, using
> ViM as editor. Therefore I'd like to be able to use R together with
> ViM.
>
> My question now is, whether there are already people out there knowing
> how to do this in a similar easy way as with Emacs, and if those would
> be willing to share this knowledge.
> I did already research on the web on this topic, but i couldn't find
> satisfying answers, except one good looking approach on the ViM-website
> with a perl-script called funnel.pl, which I couldn't make running on
> my mac OSX 10.3.9 so far.
>
> I'd be grateful for help.
>
> Thanks,
> Michael Graber
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>


--
Cheers,
-Jose
--
Jose Quesada, PhD.

[hidden email] Dept. of Psychology
http://www.andrew.cmu.edu/~jquesada                Sussex University
Brighton, UK

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Peter Dalgaard
"Jose Quesada" <[hidden email]> writes:

> Hmm, how timely.
>
> I posted yesterday my solution to integrate R and vim. The message is
> in my sent box but I don't think it showed up in the list... Here it
> is again:
>
> Hi All,
>
> If you use vim to edit R code, you may be interested in this.
> I have put together a personalized syntax file, some code templates,
> and a way to send code from Vim to R using autoHotKeys (windows).
>
> http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html
>
> Actually, the little autoHotKeys can be useful even if you don't use
> vim just to send the example R code from the help pages to the
> console.
>
> Best wishes,
> -Jose
>
> PS:
> @list moderators
> Any idea why my message (from a @gmail account) appeared in the sent
> box but never on the list?

I saw it the first time... Could it be that your mail reader is set up
to ignore mail from yourself?

Rather than resending stuff, it is preferable to check the archives

https://stat.ethz.ch/pipermail/r-help/2006-April/date.html
https://stat.ethz.ch/pipermail/r-help/2006-April/092457.html 

which are easily reachable via

> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help


--
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([hidden email])                  FAX: (+45) 35327907

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

François Pinard
In reply to this post by Michael Graber-2
[Michael Graber]

>[...] I'd like to be able to use R together with ViM.  [...]  My
>question now is, whether there are already people out there knowing how
>to do this in a similar easy way as with Emacs [...]

I've been an Emacs user for a very long time, and then, switched to Vim.
See http://pinard.progiciels-bpi.ca/opinions/editors.html, if you feel
curious, for a few personal thoughts on Emacs.

For R, I tried sticking to a mere interactive shell, taking advantage of
the "GNU readline" interface built into R, with Vim as an external
editor.  For sending R code from Vim to R, one merely selects the code
to send within Vim using the mouse, and paste it directly with the mouse
in the interactive shell window running R.  Simple and comfortable!  :-)

Emacs offers ESS, which has many interesting features.  However, despite
quite attractive, it did not fully seduce me: a bit because I try to
avoid returning to Emacs keystroke habits, a bit because ESS is heavy
weighted compared to Vim + R-in-a-shell solution, a bit because ESS adds
distracting idiosyncrasies, like scrolling differently or opening extra
windows at times.  R already offers enough options I could customize if
I want to read help in a browser or a pager, and at good speed.  (Of
course, if you use an heavy browser, you feel it; but "links -g" is OK!)

An ESS nicety that my current setup does not really replace is the
automatic highlighting or R output.  One of the advantages of this
output highlighting is visually spotting R requests and replies.  As
a compromise, I'm using this bit of a kludge in my Rprofile file:

if (interactive()) {
    local({
        options(editor='vim -c "set ft=r"')
        if (Sys.getenv('TERM') %in% c('rxvt', 'xterm')) {
            onglet = 2
            options(prompt=paste(sep='',
                                 formatC('', width=80-onglet), '\033[;30;45m',
                                 formatC('', width=onglet), '\033[0m\n',
                                 options('prompt')))
        }
    })
}

The "set ft=r" bit ensures proper highlighting and coloration within
Vim, whenever edit() or fix() are used.  Here "vim" could be replaced by
"gvim" or "gvim -f", say.  (In my Vim configuration, "vim" uses the GUI
automatically if started within X; or uses the console mode otherwise.)

Then, the R prompt is modified to visually mark each request-reply
interaction with a white separating line holding a small violet marker
at the right.  It works nicely for me in almost all circumstances (there
are a few, uncommon exceptions).  Usual scrolling of the shell window
allows me to quickly find R commands and replies, even if much less
colourful than with ESS.  I'm ready to pay that price for simplicity.

A last trick which is convenient in my case.  My X window manager allows
customization of keystrokes.  (I'm using Openbox, but surely many other
window manages offer that possibility too.)  For all 26 of
Ctrl-Alt-Letter, the same small "openbox-helper" (Python) script of mine
is called with the Letter given as an option, which may launch
applications in turn.  This is how Ctrl-Alt-R opens a shell window
running R, and Ctrl-Alt-M opens a shell window running Maxima.  In both
these shells, Ctrl-D closes the application and the window.  This is
convenient for quick mathematical jobs, and quite in the spirit of Vim
(fast and easy start/exit, instead of long running like Emacs).

--
François Pinard   http://pinard.progiciels-bpi.ca

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Martin Maechler
In reply to this post by Peter Dalgaard
>>>>> "PD" == Peter Dalgaard <[hidden email]>
>>>>>     on 19 Apr 2006 01:06:02 +0200 writes:

    PD> "Jose Quesada" <[hidden email]> writes:
    >> Hmm, how timely.
    >>
    >> I posted yesterday my solution to integrate R and
    >> vim. The message is in my sent box but I don't think it
    >> showed up in the list... Here it is again:
    >>
    >> Hi All,
    >>
    >> If you use vim to edit R code, you may be interested in
    >> this.  I have put together a personalized syntax file,
    >> some code templates, and a way to send code from Vim to R
    >> using autoHotKeys (windows).
    >>
    >> http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html
    >>
    >> Actually, the little autoHotKeys can be useful even if
    >> you don't use vim just to send the example R code from
    >> the help pages to the console.
    >>
    >> Best wishes, -Jose
    >>
    >> PS: @list moderators Any idea why my message (from a
    >> @gmail account) appeared in the sent box but never on the
    >> list?

    PD> I saw it the first time... Could it be that your mail
    PD> reader is set up to ignore mail from yourself?

    PD> Rather than resending stuff, it is preferable to check
    PD> the archives

    PD> https://stat.ethz.ch/pipermail/r-help/2006-April/date.html
    PD> https://stat.ethz.ch/pipermail/r-help/2006-April/092457.html

    PD> which are easily reachable via

    >> > [hidden email] mailing list >
    >> https://stat.ethz.ch/mailman/listinfo/r-help

Indeed. Please do check the archives.

Now back to the subject:  Jose, I think your main contribution
is based on "autoHotKeys"  and that only works on Windoze, right?
Michael explicitly mentioned he's working in Mac OS X.

Martin

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Karl Ove Hufthammer
In reply to this post by Michael Graber-2
Michael Graber wrote:

> My question now is, whether there are already people out there knowing
> how to do this in a similar easy way as with Emacs, and if those would
> be willing to share this knowledge.

I prefer Vim myself, but because of the great features in ESS, I now use
Emacs+ESS in Vi mode. Just type 'M-x viper-mode', and you'll have access
to almost all your favourite Vim commands and keybindings. It works very
well.

--
Karl Ove Hufthammer
E-mail and Jabber: [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Bill West
In reply to this post by Martin Maechler
Here is my solution for integrating R and Vim.  It uses the rcom library and
Vim's perl functionality.  Improvements or suggestions are appreciated!
#######
The following is my r.vim file.  This requires the rcom library in R.


perl << EOF
sub sendtor
{
    use Win32::OLE;
    my @pos = $curwin->Cursor();
    my $coms = $curbuf->Get($pos[0]);
    my @coms = split /\n/ , $coms;
    VIM::Msg($coms[0]);
        my $R = Win32::OLE->GetActiveObject('RCOMServerLib.StatConnector')
          || Win32::OLE->new('RCOMServerLib.StatConnector');
        $R->EvaluateNoReturn( "cat('> " . $coms[0] . "\n')");
       

    unless ( $coms[0] =~ /<-/ || $coms[0] =~ /print/ )
    {
        $coms[0] = "print(" . $coms[0] . ")";
    }
    my $temp = $R->Evaluate( $coms[0] );
    $R->Close;
}
EOF

function! Rcom()
   perl sendtor
endfunction

function! Rinit()
    !start rgui  
endfunction

map <F11> <Esc>:call Rcom()<cr>j
map <F12> <Esc>:call Rinit()<cr>
 

--Bill


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Martin Maechler
Sent: Wednesday, April 19, 2006 2:42 AM
To: Jose Quesada
Cc: [hidden email]; Michael Graber
Subject: Re: [R] R and ViM

>>>>> "PD" == Peter Dalgaard <[hidden email]>
>>>>>     on 19 Apr 2006 01:06:02 +0200 writes:

    PD> "Jose Quesada" <[hidden email]> writes:
    >> Hmm, how timely.
    >>
    >> I posted yesterday my solution to integrate R and
    >> vim. The message is in my sent box but I don't think it
    >> showed up in the list... Here it is again:
    >>
    >> Hi All,
    >>
    >> If you use vim to edit R code, you may be interested in
    >> this.  I have put together a personalized syntax file,
    >> some code templates, and a way to send code from Vim to R
    >> using autoHotKeys (windows).
    >>
    >> http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html
    >>
    >> Actually, the little autoHotKeys can be useful even if
    >> you don't use vim just to send the example R code from
    >> the help pages to the console.
    >>
    >> Best wishes, -Jose
    >>
    >> PS: @list moderators Any idea why my message (from a
    >> @gmail account) appeared in the sent box but never on the
    >> list?

    PD> I saw it the first time... Could it be that your mail
    PD> reader is set up to ignore mail from yourself?

    PD> Rather than resending stuff, it is preferable to check
    PD> the archives

    PD> https://stat.ethz.ch/pipermail/r-help/2006-April/date.html
    PD> https://stat.ethz.ch/pipermail/r-help/2006-April/092457.html

    PD> which are easily reachable via

    >> > [hidden email] mailing list >
    >> https://stat.ethz.ch/mailman/listinfo/r-help

Indeed. Please do check the archives.

Now back to the subject:  Jose, I think your main contribution is based on
"autoHotKeys"  and that only works on Windoze, right?
Michael explicitly mentioned he's working in Mac OS X.

Martin

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

R and ViM

urlwolf
In reply to this post by Martin Maechler
To: Martin Maechler <[hidden email]>

> Indeed. Please do check the archives.

Yep. Post is there.

> Now back to the subject:  Jose, I think your main contribution
> is based on "autoHotKeys"  and that only works on Windoze, right?
> Michael explicitly mentioned he's working in Mac OS X.
>
> Martin

That's correct, autoHotKeys is a win-only solution.
Bill West's solution uses use Win32::OLE, so I guess that means it's
win-only solution.

I think  François Pinard's is the easiest since it uses vim and R only
(no 3rd application/language requireed), and that would probably work
in all platforms (not sure if the "GNU readline" inferface is
implemented in all builds of R, though).

I find autoHotKey very useful (e.g., it fires vim to fill textboxes
like this one -gmail editing window-, offering syntax highlighting
etc) so I use it all the time and don't mind. I can understand those
who don't want to install it just to communicate R and an editor. In
that case, the other two solutions are better. I'll refer to them in
my Rvim page (archives).

However, the new R.vim syntax file has 3-level coloring, and I'm
working to get improved indentation, TODO, DEBUG, etc highlighting,
and other improvements. The code templates using tSkeleton (not ready
yet) may be an added advantage. Those two things you can use even if
you don't use autohotkeys of course.

--
Cheers,
-Jose

PS: it seems that google mail (as an email reader) doesn't let you see
your own messages when posting to a list you are subscribed to.

--
Jose Quesada, PhD.

[hidden email] Dept. of Psychology
http://www.andrew.cmu.edu/~jquesada                Sussex University
Brighton, UK



--
Cheers,
-Jose
--
Jose Quesada, PhD.

[hidden email] Dept. of Psychology
http://www.andrew.cmu.edu/~jquesada                Sussex University
Brighton, UK

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Bill West
Yes,  my  r.vim  ftplugin file is a windows only solution.  It is not yet at
the point, however, where it may be called a "solution". :)  It currently
only handles single lines of code.  I posted it before only as a proof of
concept.  I should have been clearer in my earier post.  

For my Linux computer I have been successfully using the R.vim script by
Johannes Ranke found in the vim scripts:

http://www.vim.org/scripts/script.php?script_id=1048


This also uses Perl, but depends on IO::Pty, which (although I am no expert)
I do not believe is available for Windows.

--Bill







 

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Jose Quesada
Sent: Thursday, April 20, 2006 9:15 PM
To: [hidden email]
Subject: [R] R and ViM

To: Martin Maechler <[hidden email]>

> Indeed. Please do check the archives.

Yep. Post is there.

> Now back to the subject:  Jose, I think your main contribution is
> based on "autoHotKeys"  and that only works on Windoze, right?
> Michael explicitly mentioned he's working in Mac OS X.
>
> Martin

That's correct, autoHotKeys is a win-only solution.
Bill West's solution uses use Win32::OLE, so I guess that means it's
win-only solution.

I think  François Pinard's is the easiest since it uses vim and R only (no
3rd application/language requireed), and that would probably work in all
platforms (not sure if the "GNU readline" inferface is implemented in all
builds of R, though).

I find autoHotKey very useful (e.g., it fires vim to fill textboxes like
this one -gmail editing window-, offering syntax highlighting
etc) so I use it all the time and don't mind. I can understand those who
don't want to install it just to communicate R and an editor. In that case,
the other two solutions are better. I'll refer to them in my Rvim page
(archives).

However, the new R.vim syntax file has 3-level coloring, and I'm working to
get improved indentation, TODO, DEBUG, etc highlighting, and other
improvements. The code templates using tSkeleton (not ready
yet) may be an added advantage. Those two things you can use even if you
don't use autohotkeys of course.

--
Cheers,
-Jose

PS: it seems that google mail (as an email reader) doesn't let you see your
own messages when posting to a list you are subscribed to.

--
Jose Quesada, PhD.

[hidden email] Dept. of Psychology
http://www.andrew.cmu.edu/~jquesada                Sussex University
Brighton, UK



--
Cheers,
-Jose
--
Jose Quesada, PhD.

[hidden email] Dept. of Psychology
http://www.andrew.cmu.edu/~jquesada                Sussex University
Brighton, UK

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Jeffrey Horner
Bill West wrote:

> Yes,  my  r.vim  ftplugin file is a windows only solution.  It is not yet at
> the point, however, where it may be called a "solution". :)  It currently
> only handles single lines of code.  I posted it before only as a proof of
> concept.  I should have been clearer in my earier post.  
>
> For my Linux computer I have been successfully using the R.vim script by
> Johannes Ranke found in the vim scripts:
>
> http://www.vim.org/scripts/script.php?script_id=1048
>
>
> This also uses Perl, but depends on IO::Pty, which (although I am no expert)
> I do not believe is available for Windows.
>
> --Bill

I've been following this thread with some interest as I use both R and
VIM, but I just want to point out that we have come full circle by *not*
answering the original thread creator's question:

https://stat.ethz.ch/pipermail/r-help/2006-April/092554.html

"My question now is, whether there are already people out there knowing
how to do this in a similar easy way as with Emacs, and if those would
be willing to share this knowledge.
I did already research on the web on this topic, but i couldn't find
satisfying answers, except one good looking approach on the ViM-website
with a perl-script called funnel.pl, which I couldn't make running on
my mac OSX 10.3.9 so far."

So this last post suggests that the VIM script (id 1048) is useful
(which it is), but in fact the original thread creator already stated
that it doesn't work for his platform.

The real answer is: there's probably no current 'similar way as with
Emacs [and ESS]' to integrate R and VIM on mac OSX 10.3.9, but I bet you
might find a better answer on the R-SIG-Mac email list here:

https://stat.ethz.ch/mailman/listinfo/r-sig-mac

So I hope this helps, Michael.

...

I point all this out to illuminate how hard it is to both "convey" a
message in email and also to "interpret" a message in email, to the
point that responses to questions on this list can really wander off on
tangents (which is not necessarily a bad thing; I had no clue the R.vim
script existed for Linux). I personally find benefit in reading both the
R-help and R-devel mailing lists, and I commend and am thankful for all
those email authors who "convey" their message in email with sincerity,
honesty, etc.

There was a recent Wired article here:

http://www.wired.com/news/technology/0,70179-0.html

that cited a "Journal of Personality and Social Psychology" paper titled
"Egocentrism over e-mail: Can we communicate as well as we think?":

http://content.apa.org/journals/psp/89/6

which essentially points out the fact that determining the tone of an
author's email is no better than chance, which I believe can lead to
misinterpretation of message and meaning, and especially when authors
use negative messages like "RTFM" (google it; you'll figure it out quickly).

--
Jeffrey Horner       Computer Systems Analyst         School of Medicine
615-322-8606         Department of Biostatistics   Vanderbilt University

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: R and ViM

Michael Graber-2
In reply to this post by Martin Maechler
dear all,

to close the open question i asked more than a month ago, i would like
to tell you my conclusions:

exchanging emails with larry clapp who wrote funnel.pl, i found out
that the tasks i wanted to be done by funnel.pl could actually, and
much more, also be done by

gnuscreen (http://www.gnu.org/software/screen/),

which is a 'a full-screen window manager that multiplexes a physical
terminal between several processes'. quite interesting thing.

anyway. what i'm doing now to use vim with r is, to open a screen
session with r and vim running within it:

%screen R

starts screen with R in it. then i open another window with 'ctrl-a c'.
'ctrl-a' start screen internal commands. in this new shell i can start
vim normally to edit my .r-file. to change windows i use 'ctrl-a
space'.

now i can split the window with 'ctrl-a S'. to jump between the
splitted halfs you can use 'ctrl-a tab'.
i normally resize the r window with 'ctrl-a :resize 8', to make 8 lines
high.

to send text from one window to another i put into my .screenrc - file:

bind y at R# paste .

this makes it possible to use 'ctrl-a y' to send your buffer to the R
window.
to get something into your buffer you make use of the screen copy mode

'ctrl-a [' starts the copy mode. now you can start copying by pressing
'space', move the cursor and then pressing 'space' again. if you want
to cut off the line numbers you can press 'v' before pressing 'space'
the second time.
now you can send the buffer as i told above.

this works pretty well so far!

what i would like to improve further is, to be able to copy whole lines
and blocks with simple commands, maybe with sending it to r directly.
any ideas?

best,
michael





On Apr 19, 2006, at 8:42 AM, Martin Maechler wrote:

>>>>>> "PD" == Peter Dalgaard <[hidden email]>
>>>>>>     on 19 Apr 2006 01:06:02 +0200 writes:
>
>     PD> "Jose Quesada" <[hidden email]> writes:
>>> Hmm, how timely.
>>>
>>> I posted yesterday my solution to integrate R and
>>> vim. The message is in my sent box but I don't think it
>>> showed up in the list... Here it is again:
>>>
>>> Hi All,
>>>
>>> If you use vim to edit R code, you may be interested in
>>> this.  I have put together a personalized syntax file,
>>> some code templates, and a way to send code from Vim to R
>>> using autoHotKeys (windows).
>>>
>>> http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html
>>>
>>> Actually, the little autoHotKeys can be useful even if
>>> you don't use vim just to send the example R code from
>>> the help pages to the console.
>>>
>>> Best wishes, -Jose
>>>
>>> PS: @list moderators Any idea why my message (from a
>>> @gmail account) appeared in the sent box but never on the
>>> list?
>
>     PD> I saw it the first time... Could it be that your mail
>     PD> reader is set up to ignore mail from yourself?
>
>     PD> Rather than resending stuff, it is preferable to check
>     PD> the archives
>
>     PD> https://stat.ethz.ch/pipermail/r-help/2006-April/date.html
>     PD> https://stat.ethz.ch/pipermail/r-help/2006-April/092457.html
>
>     PD> which are easily reachable via
>
>>>> [hidden email] mailing list >
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>
> Indeed. Please do check the archives.
>
> Now back to the subject:  Jose, I think your main contribution
> is based on "autoHotKeys"  and that only works on Windoze, right?
> Michael explicitly mentioned he's working in Mac OS X.
>
> Martin
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

contour help

Alexander Nervedi
Hi

I'd like to draw some level plots but I just cant for the live of me figure
out how to control the axis here.  The axis for both the contour plots below
appear to be the same, although one is a subset of the other. I was
wondering how I could explicitly specify the xand y axis locations here.

al

dat<-matrix(runif(50)*20, ncol = 5)
contour(dat)
contour(dat[1:2, 1:2])

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

contour help

Alexander Nervedi
In reply to this post by Michael Graber-2
Hi

I'd like to draw some level plots but I just cant for the live of me figure
out how to control the axis here.  The axis for both the contour plots below
appear to be the same, although one is a subset of the other. I was
wondering how I could explicitly specify the xand y axis locations here.

al

dat<-matrix(runif(50)*20, ncol = 5)
contour(dat)
contour(dat[1:2, 1:2])

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html