How can I specify the R version opened by ESS session in emacs? [duplicate]

荒凉一梦 提交于 2020-01-13 16:55:47

问题


When I want to open an R session in emacs, I use M-x R.

However, our server has both R 2.12 in /usr/bin/R and R 2.15 in /usr/local/bin/R. Actually, if I ask whereis R, I get the following:

$ whereis R
R: /usr/bin/R /usr/local/bin/R /usr/local/bin/R2.15 /usr/local/bin/R2.12 
/usr/local/bin/R2.7 /usr/include/R /usr/share/R /usr/share/man/man1/R.1.gz

When I try to export "R_HOME=/usr/local/bin/R2.15" from .bashrc, emacs says "WARNING: ignoring environment value of R_HOME"

Is there a way to choose which instance of R is launched? Currently, 2.15 is launched when I type R at the command line, even though M-x R launches 2.12.


回答1:


The non-ESS answer is to make sure your PATH is identical, and the version you want comes first. There appears to be difference between the shell you launch, and the launch involving Emacs. You could launch Emacs from your shell with its PATH.

The ESS answer probably involves setting some magic variable... On Windows we often set the binary directly. Here the lisp code says:

;; If you wish to call other versions of R on a Unix system, ESS
;; should auto-detect other versions of R, according to matches to the
;; variable `ess-r-versions' as described in its docstring.  Consider
;; changing that variable rather than changing inferior-R-program-name
;; if your version of R is not already auto-detected.
;;(setq-default inferior-R-program-name "R")        ; unix systems

so it should just work. I keep only R in my PATH, and another out of it so I can't test this here for you. But try fiddling with ess-r-version and/or inferior-R-program-name.



来源:https://stackoverflow.com/questions/12574738/how-can-i-specify-the-r-version-opened-by-ess-session-in-emacs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!