Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Use under macOS

Saeid Amiri edited this page Mar 30, 2018 · 2 revisions

Shortcut Keys


Shift+ctrl+L: Select Gramar

alt+ctrl+W: Open Watch

alt+ctrl+E: Remove Watch

alt+ctrl+O: Show the result in new window

cmd+enter: Run code in-line

ctrl+c: Interrupt R

alt+ctrl+Q: Quit or shutdown R

alt+ctrl+R: Restart R

Shift+Alt+R: Paste scripts in Terminal


First choose the language from the grammar in the editor using the Shift+Ctrl+L or by clicking the current grammar name in the status bar , presumably you need R.

Type your script in the editor, the Atom has auto-fill; by typing the first letter of function it appears that can be selected entering it.

Run inline

The code can be run inline, the package Hydrogen provides a modern approach of using Jupyter kernels in Atom. It lets you choose which codes (the whole file, a single line, and a selection) you want to run. The combination of Hydrogen and Atom provide unique tool to run code inline and in real time to develop the scripts because can keep track of objects and rerun.

rec1

The Atom should recognize the kernel, you should see which means Atom has access the R's kernel, otherwise you should manually choose the R's kernel from the menu Packages>Rbox>Select kernel (Shift+Ctrl+L) as the kernel of editor. Then select scripts and pressing cmd+enter to run it. If you want to have the outputs in a separate window, press Shift+Ctrl+o. Hydrogen can create small windows, called watch, to type and run the codes with messing the main codes, Shift+Ctrl+W.

Rbox has menu to run the commands

,

Note: one can interrupt R (ctrl+C), quit or shutdown kernel R (shift+ctrl+Q), and restart R (shift+ctrl+R).

Note: the recalling help in the text editor does not provide a good windows, to have a better presentation, add the display function before help, for instance to see the help about mean, type display(help(mean)). The function display() is very useful to see the output in the editor.

Note: The size of plot might not be desirable, Watch's window (Shift+Ctrl+W) provides better place to run plot, otherwise you can easily get a good figure using changing the options(), see the followings

library(repr)
x<-rnorm(10)

options(repr.plot.width=4, repr.plot.height=3)
hist(x)$plot

Run via Terminal

The code can be run in the terminal without leaving Atom. It accesses to the terminal, and the code can be transfered to it, click on the plus mark on the left down to open a terminal, typing R to run R in the terminal. To transfer the codes to terminal, select codes and press shift+alt+R, the scripts can be executed line by line as well. Atom grammar accesses to several programming languages, by opening new tabs or new windows one can run different codes without interact each other.

Example: Type the following codes, then press shift+alt+R to see the run them.

iris<-datasets::iris

newiris<-iris
newiris$Species<-NULL

kc<-kmean(newiris,3)

table(iris$Species,kc$cluster)
Clone this wiki locally