[ESS] toggle between R versions

Mark W Kimpel mwkimpel at gmail.com
Wed Feb 6 18:24:53 CET 2008


Success. Thanks for all the help. mark

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

15032 Hunter Court, Westfield, IN  46074

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

mwkimpel<at>gmail<dot>com

******************************************************************


Martin Maechler wrote:
>>>>>> "MWK" == Mark W Kimpel <mwkimpel at gmail.com>
>>>>>>     on Wed, 06 Feb 2008 11:43:03 -0500 writes:
> 
>     MWK> Alright, I must be awfully close. Here is my insert into my .emacs
>     MWK> (setq exec-path (cons
>     MWK> (expand-file-name "~/R_HOME/R-devel/R-build/bin")
>     MWK> (cons
>     MWK> (expand-file-name "~/R_HOME/R-current/R-build/bin")
>     MWK> exec-path)))
> 
>     MWK> Whichever ver of R I put inside the first expand-file-name is the one 
>     MWK> that is executed when I hit the "R" icon or "R" under "start process". 
>     MWK> With "start process > other > R-newest" nothing loads with either try.
> 
> The question is what exactly is inside
>     ~/R_HOME/R-devel/R-build/bin/
> and ~/R_HOME/R-current/R-build/bin/
> 
> I guess each has an 'R' (sh script) file in there
> 
> However the ESS code expects to find executables
> *called*
> 
> 	R
> 	R-2.5.1
> 	R-2.6.1
> 	R-2.6.2
> 	R-devel
> 	R-patched
> 	R-devel-foo
> 
> In my setup I use symbolic links to create all of these,
> inside typically /usr/local/bin/ 
> 
> Martin
> 
>     MWK> Is there something wrong with my Lisp code?
>     MWK> Mark
> 
> 
> 
>     MWK> Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
>     MWK> Indiana University School of Medicine
> 
>     MWK> 15032 Hunter Court, Westfield, IN  46074
> 
>     MWK> (317) 490-5129 Work, & Mobile & VoiceMail
>     MWK> (317) 204-4202 Home (no voice mail please)
> 
>     MWK> mwkimpel<at>gmail<dot>com
> 
>     MWK> ******************************************************************
> 
> 
>     MWK> Martin Maechler wrote:
>     >>>>>>> "MWK" == Mark W Kimpel <mwkimpel at gmail.com>
>     >>>>>>> on Wed, 06 Feb 2008 11:16:18 -0500 writes:
>     >> 
>     MWK> I"m trying to do it Martin's way because I like to keep my 
>     MWK> site-libraries separate from the R folders for ease of upgrade purposes. 
>     MWK> I know have both R-2.6.1 and R-devel on my PATH. From the shell, typing 
>     MWK> "R" gets me 2.6.1 because its first on my PATH; but from ESS now I can't 
>     MWK> get either R to start.
>     >> 
>     MWK> How can I customize emacs exec-path? From what I have read, it is 
>     MWK> initialized from the PATH variable.
>     >> 
>     >> Exactly.  That's why I tried to say that they are typically equivalent
>     >> (but not in the case where your own emacs-initialization code
>     >> modifies exec-path).
>     >> 
>     >> Martin
>     >> 
>     MWK> Mark
>     >> 
>     MWK> Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
>     MWK> Indiana University School of Medicine
>     >> 
>     MWK> 15032 Hunter Court, Westfield, IN  46074
>     >> 
>     MWK> (317) 490-5129 Work, & Mobile & VoiceMail
>     MWK> (317) 204-4202 Home (no voice mail please)
>     >> 
>     MWK> mwkimpel<at>gmail<dot>com
>     >> 
>     MWK> ******************************************************************
>     >> 
>     >> 
>     MWK> Martin Maechler wrote:
>     >> >>>>>>> "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
>     >> >> 
>     >> 
> 
>     MWK> ______________________________________________
>     MWK> ESS-help at stat.math.ethz.ch mailing list
>     MWK> https://stat.ethz.ch/mailman/listinfo/ess-help
>




More information about the ESS-help mailing list