简体   繁体   English

Sublime Text 2 和 R

[英]Sublime Text 2 and R

I am trying to use Sublime Text 2 as an interface to the statistics software R [update/edit: Solved!].我正在尝试使用 Sublime Text 2 作为统计软件 R [更新/编辑:已解决!] 的接口。

On Windows, I have tried the following:在 Windows 上,我尝试了以下操作:

  1. Installed R Tools.安装了 R 工具。 Turned out to be for Macintosh 64 only.原来只适用于 Macintosh 64。

  2. Tried to program custom build file.尝试编写自定义构建文件。 Failed: no output returned.失败:没有输出返回。

     { "cmd": "C:/Program Files/R/R-2.9.2/bin/R.exe --no-save $File" }
  3. Installed SublimeREPL.安装了 SublimeREPL。 Failed: R menu option disabled...失败:R 菜单选项已禁用...

  4. [update/edit] Tried this (see wuub's reply): [更新/编辑] 试过这个(见 wuub 的回复):

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

Open SublimeREPL's user settings like this: Preferences -> Package Settings -> SublimeREPL -> Settings - User像这样打开 SublimeREPL 的用户设置: Preferences -> Package Settings -> SublimeREPL -> Settings - User

there set default_extend_path to point to your R installation:将 default_extend_path 设置为指向您的 R 安装:

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

Running Tools -> SublimeREPL -> R should launch REPL as expected.运行Tools -> SublimeREPL -> R应该按预期启动 REPL。

For windows system you can add a new build for R (Tools -> Build System -> New Build System) and put the following lines.对于 Windows 系统,您可以为 R 添加一个新构建(工具 -> 构建系统 -> 新构建系统)并输入以下几行。 Modify the path according to your R installation directory.根据你的R安装目录修改路径。

{"cmd": ["Rscript.exe", "$file"],
"path": "C:\\Program Files\\R\\R-2.15.2\\bin\\x64\\",
"selector": "source.r"}

You can execute the entire file by pressing ctrl+B instead of starting SublimeREPL.您可以通过按 ctrl+B 而不是启动 SublimeREPL 来执行整个文件。

The build system value needs to be an array so you want;构建系统值需要是一个数组,所以你想要;

{
  "cmd": ["C:/Program Files/R/R-2.9.2/bin/R.exe", "--no-save", "$File"]
}

https://docs.sublimetext.io/guide/usage/build-systems.html#file-format https://docs.sublimetext.io/guide/usage/build-systems.html#file-format

For linux users, take a look:对于 linux 用户,请查看:

Sublime Text 2 R build System Sublime Text 2 R 构建系统

It supports multi selection and interactive R sessions.它支持多选和交互式 R 会话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM