[ESS] several R versions
Martin Maechler
maechler at stat.math.ethz.ch
Thu Sep 1 10:07:55 CEST 2005
>>>>> "Kasper" == Kasper Daniel Hansen <khansen at stat.berkeley.edu>
>>>>> on Wed, 31 Aug 2005 15:42:36 -0700 writes:
Kasper> Hi Stephen On Aug 31, 2005, at 12:00 PM, Stephen
Kasper> Eglen wrote:
>> hi Kasper, Kasper Daniel Hansen writes:
>>
>>> Hi
>>>
>>> I am currently using R with ESS v5.2.9 under Mac OS X
>>> using Carbon Emacs (Emacs v. 22.0.50.1).
>>>
>>> I have started to use two different R versions. The
>>> standard stable release is called using R in the
>>> shell. Then I have the development version which I start
>>> using R-devel (this is a symlink in /usr/local/ bin).
>>>
>>> I would like to use both versions in Emacs, eg. doing
>>> something like (all this exact form is not really
>>> relevant) M-x R and M-x R-devel
>>>
>>> I assume that it is quite easy to do so, but how?
>>>
>>>
>> not trivial, but close; here is an excerpt from the
>> documentation:
>>
>> R on Unix systems: If you have "R-1.8.1" on your
>> `exec-path', it can be started using `M-x R-1.8.1'. By
>> default, ESS will find versions of R beginning "R-1" or
>> "R-2". If your versions of R are called other names,
>> consider renaming them with a symbolic link or change the
>> variable `ess-r-versions'. To see which defuns have been
>> created for starting different versions of R, type `M-x
>> R-' and then hit [Tab]. You will then see if any defuns
>> for particular versions of R have been created. These
>> other versions of R can also be started from the
>> "ESS->Start Process->Other" menu.
>>
>> so, in the first instance, if you make a symlink in your
>> exec-path (i.e. your regular PATH) of say R-2.2 to point
>> to whatever R-devel
>>
>> then when you restart Emacs, hopefully M-x R-2.2 will
>> work.
>>
>> If your binary is called R-devel You might get some joy
>> changing ess-r-versions to something like '("R-2"
>> "R-devel")
>>
>> let us know how it goes!
Kasper> Sorry for not searching the documentation better.
Kasper> Using a symbolic link from /usr/local/bin/R-2.2.0 to
Kasper> the devl version works. Adding "R-devel" to the
Kasper> ess-r-versions do not. I assume it is because it
Kasper> searches for XXX.y.z with XXX being the
Kasper> ess-r-versions and y and z being integers (this is
Kasper> just a guess though). I have used the customize
Kasper> stuff to set the varible, the relevant parts are
Kasper> (custom-set-variables ;; custom-set-variables was
Kasper> added by Custom. ;; If you edit it by hand, you
Kasper> could mess it up, so be careful. ;; Your init file
Kasper> should contain only one such instance. ;; If there
Kasper> is more than one, they won't work right.
Kasper> '(ess-r-versions (quote ("R-1" "R-2" "R-devel")))
Kasper> (closing parantheses are left out, I just did a
Kasper> cut'n'paste.
Kasper> It would be nice not have have to put in a new
Kasper> symlink whenever I upgrade R (ok I guess I could
Kasper> just use R-1.0.0 and "know" that this is the devel
Kasper> version). And I know that some people need to keep a
Kasper> stable as well as a devel version around (especially
Kasper> since access to the devel arm of BioC requires a
Kasper> devel version of R). However, I am not sure if this
Kasper> is something worth including.
Well, I should agree with Kasper here,
I've defined my own version of 'M-x R-devel' about 6 years ago...
long before there were ess-r-versions around.
Kasper, for the moment, add the following to your ~/.emacs (or
equivalent):
(defun R-devel (&optional start-args)
"Call the development version of R (using ESS)."
(interactive "P") (let ((inferior-R-program-name "R-devel")) (R start-args)))
;; (let ..) defines variables local to its scope, very similar
;; to R's local(..) construct.
I hope one of us will find the time to make this work along the
same line as "ess-r-versions" i.e., M-x R-devel will work automagically
**WHEN** an "R-devel" is in your path.
Martin
More information about the ESS-help
mailing list