[ESS] Finding 64-bit R versions on Windows
Kevin Coombes
kevin.r.coombes at gmail.com
Mon Jul 7 18:45:45 CEST 2014
Hi,
I've been (mildly) unhappy for some time because, when ESS is finding
the "latest" R on a 64-bit version of Windows, it always manages to find
and start the 32-bit version.
And while I know that I can type "M-x R [tab]" and then click on the
correct version, that always seems like too much work.
So, I wrote the function below (which I am sure someone else could make
work much more elegantly and reliably) to always select the latest
64-bit version. Now I sill have to type "M-x R64" but I'm more-or-less
willing to do that.
Having offered up my solution to this problem, here's my request: Is it
possible to make something like this a standard part of ESS? Better yet,
would it be possible to define a new configuration variable so that the
user could specify whether to invoke the latest 32-bit or latest 64-bit
version when calling "M-x R"?
Best,
Kevin
;; the ESS "latest" code always picks the 32-bit version of R on windows.
;; This hack finds the latest 64-bit version.
(defun R64 (&optional start-args)
"Call the latest 64-bit version of R"
(interactive "P")
;; sweep through the list of R-version commands
;; to find the 64-bit ones
(defun m64 (target)
"remove string '-64bit' from target"
(if (string-match "-64bit" target)
(replace-match "" t t target)
))
(setq nobits (delq nil (mapcar 'm64 ess-r-versions-created)))
;; now use the newest version that matches a 64-bit version
(defun krc-in-newest (source)
(if source
(if (string-match source ess-newest-R)
(concat source "-64bit")
nil)
nil))
(setq pending (delq nil (mapcar 'krc-in-newest nobits)))
;; take the first one
(setq myname (car pending))
;; convert from string to symbol
(setq mysym (intern-soft myname))
;; look up the function from the symbol
(setq myfun (symbol-function mysym))
;; invoke it
(funcall myfun start-args)
)
More information about the ESS-help
mailing list