【问题标题】:How can I specify the R version opened by ESS session in emacs? [duplicate]如何在 emacs 中指定 ESS 会话打开的 R 版本? [复制]
【发布时间】:2012-09-16 11:39:32
【问题描述】:

当我想在 emacs 中打开 R 会话时,我使用 M-x R

但是,我们的服务器在 /usr/bin/R 中有 R 2.12,在 /usr/local/bin/R 中有 R 2.15。实际上,如果我问whereis R,我会得到以下信息:

$ 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

当我尝试从 .bashrc 导出“R_HOME=/usr/local/bin/R2.15”时,emacs 显示“警告:忽略 R_HOME 的环境值”

有没有办法选择启动哪个 R 实例?目前,当我在命令行中键入 R 时会启动 2.15,即使 M-x R 会启动 2.12。

【问题讨论】:

    标签: r emacs environment-variables ess


    【解决方案1】:

    非 ESS 的答案是确保您的 PATH 是相同的,并且您想要的版本是第一位的。您启动的 shell 与涉及 Emacs 的启动之间似乎存在差异。您可以使用其 PATH 从您的 shell 启动 Emacs。

    ESS 的答案可能涉及设置一些神奇的变量……在 Windows 上,我们经常直接设置二进制文件。这里的lisp代码说:

    ;; 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
    

    所以它应该可以正常工作。我在我的 PATH 中只保留了 R,并且在其中保留了另一个,所以我不能在这里为你测试这个。但是尝试摆弄ess-r-version 和/或inferior-R-program-name

    【讨论】:

    • 添加(setq-default inferior-R-program-name "R2.15") 有效!感谢您帮我解决这个问题。
    • 在 Windows 上,这有效(根据您的安装调整 R 的路径,避免路径中的空格):(add-to-list 'load-path "c:/emacs/site-lisp/ess /") (autoload 'R-mode "ess-site.el" "ESS" t) (add-to-list 'auto-mode-alist '("\\.R$" .R-mode)) (setq劣质 R 程序名称“c:​​/math/R323/bin/R”); R 的任何其他路径都将在 windows7 上从 vgoulet.act.ulaval.ca/en/emacs/windows 挂起 emacs-24.5.1@
    猜你喜欢
    • 1970-01-01
    • 2010-11-09
    • 1970-01-01
    • 2011-03-27
    • 1970-01-01
    • 2013-12-07
    • 1970-01-01
    • 2015-05-27
    • 2021-10-27
    相关资源
    最近更新 更多