更改由Sublime Text 2打开的R版本 - 在Windows中

时间:2014-03-03 17:03:33

标签: r sublimetext2

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

当我安装ST2时,我使用Enhanced 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": "/\\()\"‘-:,;~!@#$%^&*|+=[]{}`~?"

有没有人可以帮我找到办法呢? 感谢

1 个答案:

答案 0 :(得分:0)

打开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以求好运,你应该全部设置。