[R] Installing R and an editor on a USB drive

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Nov 10 15:16:47 CET 2010


On Wed, Nov 10, 2010 at 10:47 AM, Hannu Kahra <hkahra at gmail.com> wrote:

> (setq inferior-R-program-name "G:/r-2.12.0/bin/i386/rterm.exe")
>
> since R is installed on the G drive. Everything works if R is on G, but when
> changing the computer, R is usually on another drive and Emacs cannot find
> it. Is it possible to handle this case?

There's some discussion on the portable apps list about fixing up
emacs and getting the drive letter:

 http://portableapps.com/node/12042

Using:

(defvar usb-drive-letter (substring data-directory 0 3))

to get the drive letter from emacs' data-directory variable. You could
then paste this onto the start of the path to R.

I don't have a windows box with emacs on to muck with the relevant
lisp at the moment, but I reckon something like:

(defvar usb-drive-letter (substring data-directory 0 3))
(setq  inferior-R-program-name (concat usb-drive-letter
"r-2.12.0/bin/i386/rterm.exe"))

 might work. I think the substring gets the whole "X:/" part of the string.

Barry



More information about the R-help mailing list