Slide 1

Slide 1 text

R in Visual Studio Code Andrew Craig Tokyo.R #83 2020/01/25

Slide 2

Slide 2 text

Me • Andrew Craig • Data Scientist • vscode-R collaborator • GitHub: @andycraig • Twitter: @andrew_cb2 • Professional: R, Python • Hobby: Rust, Clojure, TypeScript

Slide 3

Slide 3 text

Visual Studio Code • Microsoft’s free, open source editor • Not Visual Studio! • Good text editor + IDE • I use for R, Python, Typescript, Rust • Remote editing (e.g., SSH) • Lots of extensions • I like Vim, GitLens, Rainbow Brackets

Slide 4

Slide 4 text

Visual Studio Code for R • vscode-R extension (new features! by github.com/renkun-ken) https://github.com/Ikuyadeu/vscode-R/ • languageserver R package https://github.com/reditorsupport/languageserver • radian: A 21 century R console https://github.com/randy3k/radian

Slide 5

Slide 5 text

Demo

Slide 6

Slide 6 text

Work in Progress • R Markdown support • Debugging

Slide 7

Slide 7 text

Help • https://github.com/Ikuyadeu/vscode-R/issues

Slide 8

Slide 8 text

Setup 1 • languageserver R package: source("https://install-github.me/REditorSupport/languageserver") • radian console: https://github.com/randy3k/radian

Slide 9

Slide 9 text

Setup 2: Visual Studio Code • Extensions (Ctrl-Shift-X): • R • R LSP Client • Settings (Ctrl-Shift-P, Preferences: Open Settings (UI)): • R: Rterm: Linux/Mac/Windows • R: Bracketed Paste • R: Always Use Active Terminal • R: Session Watcher • <-, %>% shortcuts (like Rstudio): https://gist.github.com/andycraig/6bcecfcc6e7d5a9104f810cac899a2d1

Slide 10

Slide 10 text

Setup 3: Project • Add code to project’s.Rprofile: https://github.com/Ikuyadeu/vscode-R#r-session-watcher- experimental • Recommended: Use package layout (DESCRIPTION file, R directory) to help languageserver index files

Slide 11

Slide 11 text

Resources • Today’s demo code: https://github.com/andycraig/vscode-R-presentation • Writing R in VSCode: A Fresh Start https://renkun.me/2019/12/11/writing-r-in-vscode-a-fresh-start/ • Writing R in VSCode: Interacting with an R session https://renkun.me/2019/12/26/writing-r-in-vscode-interacting-with- an-r-session/