R in Visual Studio Code

R in Visual Studio Code

822cde5b176ef140171a27f8294c2bd8?s=128

Andrew Craig

January 25, 2020
Tweet

Transcript

  1. 2.

    Me • Andrew Craig • Data Scientist • vscode-R collaborator

    • GitHub: @andycraig • Twitter: @andrew_cb2 • Professional: R, Python • Hobby: Rust, Clojure, TypeScript
  2. 3.

    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
  3. 4.

    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
  4. 5.
  5. 9.

    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
  6. 10.

    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
  7. 11.

    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/