Category: Programming

The current state of R support in Atom


This is a guide to the current state of R support in Atom. I’m not writing this as an expert on Atom, merely as a user.

This guide is geared towards Mac as I do not have experience on either Linux or Windows.

All of these packages can be installed with the Atom package manager either via commandline (apm install) or in the GUI (Preferences → Install).

With all of these packages, don’t forget to take a look at the command palette (cmd-shift-p) which will give you quick access to commands both bound and unbound to keys.

DISCLAIMER: I am the maintainer of r-exec.

syntax highlighting

standard R files

The syntax highlighting for *.R files is quite good and support is built into the language-r package. It builds basic syntax highlighting and was originally ported from the r.tmbundle TextMate package. There hasn’t been much activity on the GitHub repository as of late, but I think the package is quite stable so there isn’t too much work to be done (in terms of basic functionality). I have been using it without any major issues for at least a year.

R Markdown

Early 2016 I added very crude support in language-gfm for R markdown blocks. This will give you standard functionality out of the box (language-gfm is a base package), however, it is a bit clunky. Earlier this year language-markdown added very good support, and in my opinion, is a much better package all around for editing all sorts of Markdown files. The biggest benefit of language-markdown over language-gfm for editing Rmd is proper syntax parsing of decorators. An example is {r eval=TRUE} parses nicely and a typo like {r eva=TRUE} would be obvious (see image below).

Example of language-markdown parsing syntactically (in)correct Rmd decorators


As far as I can tell, there really isn’t any good syntax highlighting for LaTeX style Rnw knitr files in Atom. But with the ease of R Markdown, unless you are writing a lot of math, I would suggest against using Rnw anyway. I have looked at adding support for it and it doesn’t seem like too much work. However, I have little incentive since I don’t really write Rnw. If you are interested in picking up this project, let me know and I might be able to guide you a little bit.


The Atom autocompletion engine (autocomplete-plus, bundled with Atom) is quite good and has providers for many languages including R support which is relatively recent. Without the specific R support autocomplete-plus, (bundled with Atom) does a decent job at finding text within your buffers and auto completing it. Installing autocomplete-R will give you more elaborate autocompletion of built-in R functions along with their arguments. The author has expressed interest in providing this functionality for other packages as well.

The image below showcases this functionality:

Example of autocomplete-R

running code

Personally, my workflow includes using iTerm2 for remote execution of code, along with RStudio server, and sometimes locally executing code in As far as I know, the only package with capability to send code to all of these applications in Atom is r-exec. It is simple to configure which application you are sending code to (either in the Packages menu or type cmd-shift-p and begin typing r exec to see a list of options).

r-exec has the ability to send the current line, paragraph, function, and RMarkdown block. It also has additional features to jump to the next logical block (line, paragraph, etc.) after a command has been sent.
Recently, support for ‘smart’ insertion of operators (currently assignment and the pipe operator) has been implemented. This means if there is whitespace on the left or right of the cursor, it will not insert additional whitespace when an operator has been inserted via the operator shortcut.

In the near future I plan adding support for internal Atom terminals (e.g. Term3). I also plan to add support for building RMarkdown internally. If others can help, it would be great to get support on Linux and Windows.

There are also other packages that are available for executing code which I have no experience with but I am sure others use:

  • hydrogen which adds in-line support for Jupyter notebooks (Python, Julia).
  • build-rscript which will run Rscript on a R file.

navigating code

Atom has a pretty good ctags engine, atom-ctags. Matching rules for tags have to be specified in a file before you can begin using it with R. Some guidance on this can be found here.
After the tags have been built for a specific project, you can jump between symbols using ctrl-option-down when the cursor is above a specific symbol.

static code analysis (linting)

Linting can be done using the linter-lintr package. It uses the popular R linter lintr and has pretty standard warning/error reporting in the Atom ‘gutter’.

The figure below (pulled from the lintr website) displays the functionality nicely:

example of lintr

summary and links