【问题标题】:Change the R version opened by Sublime Text 2 - in Windows更改 Sublime Text 2 打开的 R 版本 - 在 Windows
【发布时间】:2014-03-03 17:03:32
【问题描述】:

我的问题是我想从 ST2 使用 R 3.0.2 运行 R 脚本。

当我安装 ST2 时,我使用增强型 R 包对其进行了配置,以便能够从 ST2 运行 R 脚本。完成的连接使用 R 2.15.2。现在我想从 ST2 自动运行 R 3.0.2。我没有通过尝试修改首选项>包设置>增强R>设置默认设置Sublime Text 2 and R中建议的设置用户中的修改脚本:

"default_extend_env": {"PATH": "{PATH};C:\\Program Files\\R\\R-3.0.2\\bin\\i386"}  

和设置默认脚本(我复制了所有但我使用 Windows):

"osx" : {
    // R / R64 / Terminal / iTerm
    "App" : "R"
    // path to Rscript binary
    // "Rscript" : "/usr/bin/Rscript",
},

"windows" : {
    // R32 / R64
    "App" : "R64"

    // path to R binary
    // "R32" : "C:\\Program Files\\R\\R-3.0.2\\bin\\i386\\Rgui.exe",
    // "R64" : "C:\\Program Files\\R\\R-3.0.2\\bin\\x64\\Rgui.exe",

    // path to Rscript binary
    // "Rscript" : "C:\\Program Files\\R\\R-3.0.2\\bin\\x64\\Rscript.exe",
},

"linux": {
    // tmux / screen
    "App" : "tmux"

    // path
    // "tmux" : "tmux",
    // "screen" : "screen",

    // path to Rscript binary
    // "Rscript" : "",
},

// auto advance lines after sending command
"r_auto_advance": true,

// auto completions
"r_auto_completions": true,

// a list of packages which functions will show in the status bar
// "default_pkgs": ["base", "graphics", "grDevices", "methods", "stats", "utils"],

// a list of extensions
"extensions": ["r", "R", "s", "S", ".Rprofile"]

//  Allows for  '.' in R object names
// "word_separators": "/\\()\"‘-:,;~!@#$%^&*|+=[]{}`~?"

有人可以帮我找到方法吗? 谢谢

【问题讨论】:

  • 您是否将cmd 和路径设置为指向您的 R3 安装?
  • 你的意思是在控制面板中我应该在“环境变量”中添加一个新路径吗?或者你的意思是直接在 ST2 中?
  • 直接在 ST2 中。不要指向 R-2 可执行文件,而是指向 R-3 可执行文件。
  • 是的,我已经做到了。我试图在 Ehanced-R>setting default 和 user 中指出 R3,但它仍然打开 R 版本 2.15.2。我关闭了 ST2 并重新打开并重新启动了我的计算机,但没有工作...
  • edit您的问题并发布您的增强型 R 设置的全文,包括默认设置和用户设置(如果它们不同)。顺便说一句,如果您想更改默认值,它应该在用户设置中完成 - 如果/当软件包升级时,默认文件将被覆盖,这可能很常见。

标签: r sublimetext2


【解决方案1】:

打开Preferences -> Package Settings -> Enhanced R -> Settings-User并将其内容替换为以下内容:

{
    "windows" : {
        // R32 / R64
        "App" : "R64",

        // path to R binary
        // "R32" : "C:\\Program Files\\R\\R-3.0.2\\bin\\i386\\Rgui.exe",
        "R64" : "C:\\Program Files\\R\\R-3.0.2\\bin\\x64\\Rgui.exe",

        // path to Rscript binary
        "Rscript" : "C:\\Program Files\\R\\R-3.0.2\\bin\\x64\\Rscript.exe"
    },

    // auto advance lines after sending command
    "r_auto_advance": true,

    // auto completions
    "r_auto_completions": true,

    // a list of packages which functions will show in the status bar
    // "default_pkgs": ["base", "graphics", "grDevices", "methods", "stats", "utils"],

    // a list of extensions
    "extensions": ["r", "R", "s", "S", ".Rprofile"],

    //  Allows for  '.' in R object names
    "word_separators": "/\\()\"‘-:,;~!@#$%^&*|+=[]{}`~?"
}

您需要确保Rgui.exeRscript.exe 二进制文件的路径正确。请注意,这是在使用 64 位 R 的 64 位系统上。如果您在 32 位系统上,请改用以下代码:

{
    "windows" : {
        // R32 / R64
        "App" : "R32",

        // path to R binary
        "R32" : "C:\\Program Files\\R\\R-3.0.2\\bin\\i386\\Rgui.exe",
        // "R64" : "C:\\Program Files\\R\\R-3.0.2\\bin\\x64\\Rgui.exe",

        // path to Rscript binary
        "Rscript" : "C:\\Program Files\\R\\R-3.0.2\\bin\\i386\\Rscript.exe"
    },

    // auto advance lines after sending command
    "r_auto_advance": true,

    // auto completions
    "r_auto_completions": true,

    // a list of packages which functions will show in the status bar
    // "default_pkgs": ["base", "graphics", "grDevices", "methods", "stats", "utils"],

    // a list of extensions
    "extensions": ["r", "R", "s", "S", ".Rprofile"],

    //  Allows for  '.' in R object names
    "word_separators": "/\\()\"‘-:,;~!@#$%^&*|+=[]{}`~?"
}

保存文件,重启 Sublime 祝你好运,一切准备就绪。

【讨论】:

  • 路径很好,但我在保存脚本时出错“尝试解析设置时出错:意外字符,在 C:\...\Enhanced-R.sublime- 中需要逗号或右括号-设置:8:9"。如果我按照建议用逗号更改“:”或什么都没有,它也不起作用......
  • @user3016665 - 我刚刚编辑了我的答案 - 缺少 2 个逗号。请立即尝试并告诉我它是如何工作的。
猜你喜欢
  • 2013-09-18
  • 1970-01-01
  • 1970-01-01
  • 2014-05-23
  • 2017-03-01
  • 1970-01-01
  • 2012-03-07
  • 2012-07-04
  • 1970-01-01
相关资源
最近更新 更多