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

R in Visual Studio Code

822cde5b176ef140171a27f8294c2bd8?s=47 Andrew Craig
January 25, 2020

R in Visual Studio Code

822cde5b176ef140171a27f8294c2bd8?s=128

Andrew Craig

January 25, 2020
Tweet

More Decks by Andrew Craig

Other Decks in Programming

Transcript

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

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

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

  6. Work in Progress • R Markdown support • Debugging

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

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

    https://github.com/randy3k/radian
  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
  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
  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/