2

If someone could walk me through a particular problem, I'd really appreciate it... I think I know what's causing it, but I don't know how to fix it.

Problem-- Emacs ESS won't start up R.

Cause-- I've installed OpenFOAM, an open source fluids modeling kit that has it's own function called R, and executes with the letter "R". (I.e. type "R" in the command line and it tries to run an OpenFOAM function, not R). I think by installing OpenFoam, I have overwritten the previous "R" calling the language R, and so that messes with ESS trying to call R.

Environment-- I'm ssh'ing into a remote client running scientific linux where I don't have root access. I don't exactly understand what ESS is calling that is local to my account and what is not local.

Calling /usr/bin/./R from the command line starts an instance of R. How do I modify ESS such that it calls '/usr/bin/./R'?

This was the closest I could find, ESS to call different installations of R, but as far as I can tell, my system doesn't have R-1 or R-2 at all on its exec path, so I don't know how similar it is.

Community
  • 1
  • 1
Lucas Spangher
  • 339
  • 2
  • 14
  • 1
    I'm not sure I follow what OpenFOAM is doing, but perhaps a piece of [this answer](http://stackoverflow.com/questions/16860694/ess-does-not-find-rterm-exe-on-windows/16862609#16862609) will help you fix your problem. Among other things, it shows how you can put versions R-3.*.* of R on your exec path. – Josh O'Brien Nov 22 '13 at 19:15
  • Hmm... it's not working for me yet. Is there a way to find out what exactly ESS is calling when it tries to start up R? – Lucas Spangher Nov 22 '13 at 19:25
  • Also, I think that was for Windows. Does Unix even have .exe files? – Lucas Spangher Nov 22 '13 at 19:35
  • 1
    On my (functioning) Emacs, `C-h f R` tells me that `M-x R` launches an interactive lisp function that calls R. Doing `M-x R ` also offers a number of R-related completions. – Josh O'Brien Nov 22 '13 at 19:36
  • 1
    You're right about the Windows bit. Still, `C-h f R` should tell you what `M-x R` runs. I probably can't be much more help, though, as I'm not any sort of Emacs/ESS wizard. – Josh O'Brien Nov 22 '13 at 19:37
  • Thanks @JoshO'Brien. Right now M-x R is failing, but C-h R is telling me that ESS IS trying to call 'R', the 'GNU S' from the R Foundation. The M-x R completion is what was troubling me too -- the only completions are things that don't seem to fit: R-newest instead of R-3.0.0. or something. – Lucas Spangher Nov 22 '13 at 19:44
  • 1
    `R-newest` is related to R (try `C-h f R-newest` to see that). It **does** sound like ESS isn't being able to find the directory in which your R executables are located. On Windows, I'd say check the values of `C-h v inferior-R-program-name`, `C-h v ess-directory-containing-R` and `C-h v ess-r-versions`, but if Unix uses a different system for these things than does Windows, I suppose those won't help. – Josh O'Brien Nov 22 '13 at 19:52

1 Answers1

3

I had run into the same problem. Following the links and tips of Josh O'Brien, I put

;; Set default R version, (i.e. the one launched by typing M-x R <RET>)
(setq inferior-R-program-name "/usr/bin/R")

in my .emacs file. Now it works perfectly.

Gavin Simpson
  • 170,508
  • 25
  • 396
  • 453
Andy---
  • 31
  • 3