Upgrade to Pro — share decks privately, control downloads, hide ads and more …

R in Visual Studio Code

Andrew Craig
January 25, 2020

R in Visual Studio Code

Andrew Craig

January 25, 2020
Tweet

More Decks by Andrew Craig

Other Decks in Programming

Transcript

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

    • GitHub: @andycraig • Twitter: @andrew_cb2 • Professional: R, Python • Hobby: Rust, Clojure, TypeScript
  2. 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. 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. 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
  5. 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
  6. 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/