Skip to content

Latest commit

 

History

History
162 lines (141 loc) · 8.47 KB

README.org

File metadata and controls

162 lines (141 loc) · 8.47 KB

ESS (R) layer

img/r.jpg

Table of Contents

Description

This layer adds support for statistical programming languages to Spacemacs.

Features:

  • Syntax highlighting
  • Auto-completion
  • Syntax-checking via lintr
  • Additional data viewer for R via ess-R-data-view
  • Support for Org-Babel
  • Showing of inline help for R constructs
  • Repl support via R terminal
  • Support for S, SAS and R
  • Much more via the ESS Project

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add ess to the existing dotspacemacs-configuration-layers list in this file.

Also install lintr library via the R terminal to enable syntax checking. To do so start the R terminal and type below code.

install.packages("lintr")

Options

Use a key binding to insert <-:

(setq-default dotspacemacs-configuration-layers '((ess :variables
                                                       ess-assign-key "\M--")))

Key bindings

Inferior REPL process

Send code to inferior process with these commands:

Key bindingDescription
SPC m '​start REPL
SPC m ,​send region, current function, or paragraph and step
SPC m s istart REPL
SPC m s sswitch between file and REPL
SPC m s Sswitch the process associate with file
SPC m s bsend buffer and keep code buffer focused
SPC m s Bsend buffer and switch to REPL in insert mode
SPC m s dsend region or line and step
SPC m s Dsend function or paragraph and step
SPC m s fsend function and keep code buffer focused
SPC m s Fsend function and focus REPL
SPC m s lsend line and keep code buffer focused
SPC m s Lsend line and focus REPL
SPC m s rsend region and keep code buffer focused
SPC m s Rsend region and focus REPL

Help

Get help and helpers for inspecting objects at point are available in R buffers only.

Key bindingDescription
SPC m h ahelp apropos
SPC m h ddisplay help on object
SPC m h edescribe object
SPC m h hdisplay help on object
SPC m h idisplay index for package
SPC m h mmanual lookup
SPC m h odisplay demos
SPC m h pview data under point using [ess-R-data-view][ess-R-data-view]
SPC m h rlookup reference
SPC m h tview table using [ess-R-data-view][ess-R-data-view]
SPC m h vdisplay vignettes
SPC m h whelp web search
C-jnext item in REPL history
C-kprevious item in REPL history

More interaction with the REPL

Helpers that provide further interaction with the REPL.

Key bindingDescription
SPC m r /set working directory
SPC m r TABinstall package
SPC m r dedit object source or dump() object into a new buffer
SPC m r eexecute a command in the ESS process
SPC m r iinstall package
SPC m r lload installed package
SPC m r rreload ESS process
SPC m r sset source style
SPC m r tbuild tags for directory
SPC m r wset “width” option

R devtools

Interaction with the R devtools package.

Key bindingDescription
SPC m w TABinterface for devtools::install()
SPC m w aask for a devtools command and runs it
SPC m w cinterface for devtools::check()
SPC m w dinterface for devtools::document()
SPC m w iinterface for devtools::install()
SPC m w linterface for devtools::load_all()
SPC m w rinterface for devtools::revdep_check()
SPC m w sset a package for ESS r-package commands
SPC m w tinterface for devtools::tests()
SPC m w uinterface for devtools::unload()

Debugging

Tools for debugging

Key bindingDescription
SPC m d ?ess-tracebug-show-help
SPC m d `show traceback and last error message
SPC m d \~display call current call stack
SPC m d bset breakpoint
SPC m d Bset conditional breakpoint
SPC m d dset debugging flag for function
SPC m d etoggle the on-error action
SPC m d ijump to point where the last debugger or traceback event occurred
SPC m d kkill breakpoint
SPC m d Kkill all breakpoints in buffer
SPC m d lSet breakpoint logger
SPC m d ngo to next breakpoint
SPC m d Ngo to previous breakpoint
SPC m d pgo to previous breakpoint
SPC m d otoggle breakpoint state
SPC m d sset environment for evaluation
SPC m d ttoggle tracebug
SPC m d uunflag function for debug
SPC m d wtrigger ESS watch mode

Editing Markdown

Edit Markdown files

Key bindingDescription
SPC m c Csend knitr/sweave chunk and switch to REPL in insert mode
SPC m c csend knitr/sweave chunk and keep buffer focused
SPC m c dsend knitr/sweave chunk and step to next chunk
SPC m c mmark knitr/sweave chunk around point
SPC m c nnext knitr/sweave chunk
SPC m c Nprevious knitr/sweave chunk