A Sublime Text plug-in that tries to bring parts of the user experience of RStudio to Sublime Text. It is primarily designed to fulfill my personal needs, but you may find it useful as a template for your own customizations. SublimeStudio has borrowed heavily from R-Box by randy3k (which is available through package control).
-
a prominent top level menu in SublimeStudio. You will love it (if R is your main language), or hate it (otherwise).
-
RStudio niceties: shiny, rmarkdown, roxygen, load all, build and reload
-
Support for different versions of R (or S-plus, or remote R sessions)
-
An efficient debugging strategy
-
Windows and Mac support
-
Download the zip folder. Unzip.
-
Move the
SublimeStudio
folder to your package directory (Preferences > Browse Packages
). -
On Windows, adjust the path to your R installation(s) in
SublimeStudio.sublime-settings
.
All functions can be called from the SublimeStudio menu; the more frequent ones also have a short-key:
Many functions from the menu need the 'R-directory' to be set. Press Shift+Ctrl/Cmd+H to use the current file's folder as the 'R-directory'. If you use, e.g., LoadAll (Shift+Ctrl/Cmd+L), this directory will be loaded.
For convenience, if you are inside the R subfolder of an R package, the parent folder is chosen.
If you want to run a Shiny app, make the directory of your shiny app (the
one with ui.R
and server.R
) your 'R-directory'. Press Shift+Ctrl/Cmd+A to run the app.
For R debugging, I find the following strategy useful:
-
Mark the command you want to investigate and save it in the SublimStudio R-Buffer (Shift+Ctrl/Cmd+O). It stays there until you re-assign the buffer.
-
Set a
browser()
somewhere in your function. -
Press Shift+Ctrl/Cmd+L: This saves the file, re-loads the package (using devtools) und runs the buffer line, so that R will halt were you set the browser. (Make sure the option
browserNLdisabled
is set toTRUE
; otherwise new lines will quit the browser.) -
After changing the code, press Shift+Ctrl/Cmd+Q to quit the browser and Shift+Ctrl/Cmd+L to retry.
Press Shift+Ctrl/Cmd+V to select different versions of R. Occasionally, I also use S-plus with SublimeStudio, which helps me forget that I use S-plus. I also added a terminal option (on Mac) to work directly on a Linux server.
Randy3k, as mentioned. Autohotkey, which is
included in the bin
folder and used on Windows to transfer data from
Sublime Text to R.