Atom Packages Directory

a package directory for a text editor of the 21st Century

R Exec

Install with:
    apm install r-exec
  

r-exec

Send R code from Atom to be executed in R.app, Terminal, iTerm, or a web browser running RStudio Server on Mac OS X. The current selection is sent or in the case of no selection the current line is sent.

Installation

apm install r-exec

or

Search for r-exec within package search in the Settings View.

Configuration

Keybindings

While cmd-enter is bound to sending code in the package, it is also annoyingly bound to entering a new line by default in atom. In order to make it work, you must add the following binding in ~/.atom/keymap.cson:

javascript 'atom-workspace atom-text-editor:not([mini])': 'cmd-enter': 'r-exec:send-command'

Behavior

All configuration can be done in the settings panel. Alternatively, you can edit your configuration file as noted below.

In your global configuration file (~/.atom/init.coffee), you may set the following variables:

The default configuration looks like this:

javascript atom.config.set('r-exec.whichApp', 'R.app') atom.config.set('r-exec.advancePosition', false) atom.config.set('r-exec.skipComments', true) atom.config.set('r-exec.focusWindow', true) atom.config.set('r-exec.notifications', true) atom.config.set('r-exec.smartInsertOperator', true)

Inserting operators

r-exec currently supports inserting the assignment (<-) and pipe (%>%) operators. It tries to be smart by looking if there is whitespace to the left or the right of the cursor. If there is already whitespace it will not insert additional whitespace. Otherwise, it will insert whitespace. This can be disabled in the settings tab (Smart Insert Operator).

Notes about iTerm

The iTerm2 Applescript API recently changed as of version 3.0.0. Older versions of iTerm2 (< 3.0.0) are supported using mode iTerm. Newer versions of iTerm2 (>= 3.0.0) are supported using mode iTerm2.

Usage

Sending code

Inserting operators

Notes

It is currently Mac-only because these things are easy to do with AppleScript. Any help on the Windows or Linux side would be great.

TODO

Keywords: r, rstats, code, run, runner Suggest keywords
Fork me on GitHub