[ESS] toggle between R versions

Martin Maechler maechler at stat.math.ethz.ch
Wed Feb 6 08:52:47 CET 2008


>>>>> "RMH" == Richard M Heiberger <rmh at temple.edu>
>>>>>     on Tue, 5 Feb 2008 23:57:18 -0500 writes:

    RMH> That is supposed to work on Linux with no further
    RMH> intervention from the user.  Please reply to the list
    RMH> with which versions of OS, emacs, ESS you are using.
    RMH> Are you doing anything strange in your site-start.el or
    RMH> .emacs file?  Where are the R files living?  Are they
    RMH> in the default place for Linux distributions?  I am
    RMH> very puzzled that Other/ doesn't contain at least three
    RMH> items: R-newest, R-2.6.1, R-devel.  They are usually
    RMH> placed on that menu automatically when ess-site is
    RMH> started.

    RMH> Try manually entering
    RMH> M-x R-devel
    RMH> and let the list know if that was able to start the alternate version.

For all this to work, these versions of R must be in Mark's
PATH when emacs is started, or, actually rather in
Emacs'  exec-path variable at the time the ESS lisp code is
loaded.




    RMH> -----Original Message-----
    RMH> From: Mark W Kimpel [mailto:mwkimpel at gmail.com] 
    RMH> Sent: Tuesday, February 05, 2008 11:40 PM
    RMH> To: Richard M. Heiberger
    RMH> Cc: ess-help at stat.math.ethz.ch
    RMH> Subject: Re: [ESS] toggle between R versions

    RMH> Richard,

    RMH> This was the first thing I tried, but the only thing listed under 
    RMH> "other" is "R-newest", which when I tried it, loaded R-2.6.1 just as "R" 
    RMH> does. I am not using Windows, which may keep track of versions in the 
    RMH> registry, but Linux, where I have to put a symbolic link to R in /usr/bin

    RMH> mark

    RMH> Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
    RMH> Indiana University School of Medicine

    RMH> 15032 Hunter Court, Westfield, IN  46074

    RMH> (317) 490-5129 Work, & Mobile & VoiceMail
    RMH> (317) 204-4202 Home (no voice mail please)

    RMH> mwkimpel<at>gmail<dot>com

    RMH> ******************************************************************


    RMH> Richard M. Heiberger wrote:
    >> When you are in a myfile.r buffer, click on the emacs menu item
    >> ESS/Start Process/Other/
    >> This will give you a list of all versions of R on your computer.
    >> Click one of them and it will execute inside an *R* buffer.
    >> 
    >> -----Original Message-----
    >> Behalf Of Mark W Kimpel
    >> Sent: Tuesday, February 05, 2008 11:11 PM
    >> Subject: [ESS] toggle between R versions
    >> 
    >> I have both R-2.6.1 and R-devel installed on Ubuntu Gutsy, each with 
    >> their own site-library, although currently I go into .Rprofile to 
    >> manually change with site-library will be loaded. When starting R from 
    >> within ESS-Emacs, I would like to be able to instruct which version I 
    >> want to use. Is this possible?

yes. That's what Rich has been trying to help you with above

    >> For this to work, I would also need 
    >> .Rprofile to detect the version of R and use the appropriate site-library.

that's the R part - maybe even more easy for you.. :
I do similar things.
If all the R versions you use are good enough to have getRversion(),
then use that.
The help  ?getRversion  contains this as part of its
examples :

     if(getRversion() <= "2.5.0") { ## work around missing feature
       cat("Your version of R, ", as.character(getRversion()),
           ", is outdated.\n",
           "Now trying to work around that ...\n", sep = "")
     }

otherwise {for *old* versions of R}, you need 
        RVersion <- paste(R.version$major, R.version$minor, sep=".")

*and* then must be more careful with the if(.) but
      if(RVersion == "2.6.1") 
will also work and most  '<=' or '>=' will work correctly as well

    >> 
    >> Can all or any of this be done?

yes indeed




More information about the ESS-help mailing list