Chapter 3 VS Code

vscode-R is the R Extension for Visual Studio Code. The extension is mainly focused on providing language service based on static code analysis and user interactivity between VS Code and R sessions.

You can run R in VS Code. Simply open the folder containing your R scripts in VS Code, and then open the command palette (Cmd+Shift+P) and type “R: Create R terminal”. This will start an R session in the terminal.

  • By default, this will close the currently open folder.
  • If you want multiple windows each with their own folder, you first open a new window (Ctrl + Shift + N) and then open the folder in that new window.

rstudioapi::restartSession() will restart the R session.

Command Palette, type “R: Interrupt R” to interrupt the current R session.