Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
VS Code runs R through the REditorSupport R extension (often called vscode-R). This guide is for researchers who already use R and want to work in Visual Studio Code: after reading it you can install the extension, start an R terminal, send code from a script to R, and know where plots, data frames and help appear. All setup details below come from the extension’s own README and wiki (read 2026-11-11).
What VS Code and the R extension are used for in research
VS Code does not run R by itself. The extension REditorSupport.r (marketplace identifier reditorsupport.r, MIT licence) adds R support: snippets, a language service (completion, signature help, outline, formatting, go to definition, diagnostics, references), commands that send code to an R terminal, and viewers for the workspace, help pages, data frames and plots. It also highlights, runs and previews R Markdown chunks and works over Remote Development (SSH, Containers, WSL).
Researchers typically choose this setup when they already use VS Code for other languages or need to edit R on a remote machine, for example a cluster reached over SSH. If you only work in R and want a dedicated IDE, the alternatives table below lists options. For analysis that others must be able to rerun, pair the editor with a package-version lock such as renv, which matters for computational reproducibility.
How to install or access it
Requirements
- R 3.4.0 or later (README).
- A recent VS Code. The README states VS Code 1.101.0 or later, while the Windows and Linux wiki pages state that vscode-R 3.0.0 requires VS Code 1.110 or later. Use the higher figure, or the minimum shown on the extension’s marketplace page, if you are unsure.
- The
languageserverR package, which powers completion, diagnostics and navigation.
If R is not installed yet, follow how to install R and RStudio first.
Install the extension
- Open the Extensions view in VS Code and search for
reditorsupport.r. - Install the extension published as REditorSupport.r (source: github.com/REditorSupport/vscode-R).
- In R, install the language server:
install.packages("languageserver"). The wiki also documents the development version:remotes::install_github("REditorSupport/languageserver")(on Windows this needs Rtools).
Step-by-step: start R and run your first script
- Open a folder containing your
.Rfile (File > Open Folder). - Open the Command Palette and run R: Create R terminal.
- The first time a managed R terminal starts, accept the prompt to install the bundled
sessR package. - If R was installed from CRAN with default options, the defaults work. Otherwise set
r.consolePath(the console executable used by “R: Create R terminal”) in Settings. Setr.executablePathonly if background processes need a separate, vanilla R executable. - Select lines in your script and run them in the R terminal with the command
r.runSelection. The wiki does not document a default key for it, so open Keyboard Shortcuts (Ctrl+K Ctrl+S, or Cmd+K Cmd+S on macOS), search forr.runSelectionand read or assign the binding there.
The wiki’s suggested manual bindings for package development are: ctrl+shift+f10 for r.createRTerm, f1 for r.helpPanel.openForSelection, ctrl+shift+b for r.install, ctrl+shift+e for r.check, ctrl+shift+t for r.test, ctrl+shift+d for r.document and ctrl+shift+l for r.loadAll. These are suggestions you add yourself, not defaults.
Optional add-ons
- Formatted hover help:
install.packages("rmarkdown"). Pandoc comes with RStudio; otherwise install it from pandoc.org. - Debugger: install the extension
RDebugger.r-debuggerand, in R,remotes::install_github("ManuelHentschel/vscDebugger"). - Plot viewer backends:
install.packages("jgd")and/orinstall.packages("httpgd", repos = c("https://nx10.r-universe.dev", "https://cran.r-project.org")). The settingr.plot.backenddefaults to"auto", which tries JGD, then httpgd, then the standard viewer.
Output and how to read it
- R terminal: console output and errors from code you send appear here, exactly as in a normal R session.
- Workspace viewer: lists objects in the session.
- Data viewer: opens data frames, matrices, Arrow tables and polars data.
- Plot viewer: shows graphics through the jgd or httpgd backend, with a PNG/SVG fallback.
- Help viewer: shows R help pages inside VS Code.
- Widgets and Shiny: htmlwidgets and Shiny apps display in a viewer pane.
- R Markdown: chunks are highlighted and can be run, and documents previewed. If you are choosing a report format, see Quarto vs R Markdown.
Troubleshooting
No completion, hover or diagnostics
The language features need the languageserver package. Install it from R as shown above and reload the VS Code window.
“R: Create R terminal” starts the wrong R or fails
Set r.consolePath to the R console executable you want. If you have several R versions, r.executablePath controls the R used for background processes, so check both.
VS Code on Windows, R inside WSL
The Windows wiki notes that connecting can fail when R lives in WSL but VS Code runs on Windows. Open VS Code from inside WSL instead, with code <directory>.
Plots do not appear in the viewer
Install jgd or httpgd as above, or check that r.plot.backend has not been set to a backend that is not installed.
Still stuck
The project directs users to its GitHub Discussions Q&A, the issue tracker and the per-operating-system installation wiki pages (Windows, macOS, Linux).
Free alternatives to VS Code for R
| Option | What the source says | Where to read more |
|---|---|---|
| Positron | Described by Posit as “a free IDE purpose-built for data science”, with a multi-session console for Python, R, SQL and more. Licensed under the Elastic License 2.0, a source-available licence (not open source). | positron.posit.co (read 2026-11-11) |
| RStudio | The dedicated R IDE covered in CASRAI’s walkthrough of panes, projects and scripts. | How to use RStudio |
| Browser-based RStudio | Cloud and server options for running RStudio without a local install. | RStudio on the cloud |
For software other than R, see free statistical software for research.
FAQ
Can you use R in VS Code?
Yes. Install R, install the REditorSupport R extension (reditorsupport.r) from the VS Code marketplace, and install the languageserver R package. The extension then provides editing support and an R terminal.
Do I need RStudio to use the extension?
No. RStudio is only relevant for Pandoc: the wiki says Pandoc comes with RStudio, otherwise install it separately for formatted hover help.
Does the extension work on a remote server?
The README lists Remote Development over SSH, Containers and WSL as supported, and says code can be sent to remote R terminals.
Which VS Code version do I need?
The README says 1.101.0 or later; the wiki says vscode-R 3.0.0 requires 1.110 or later. The higher number is the safe choice.
Sources
- REditorSupport, vscode-R README: github.com/REditorSupport/vscode-R (read 2026-11-11)
- vscode-R wiki, Installation: Windows and Installation: Linux: github.com/REditorSupport/vscode-R/wiki (read 2026-11-11)
- vscode-R wiki, Keyboard shortcuts: github.com/REditorSupport/vscode-R/wiki/Keyboard-shortcuts (read 2026-11-11)
- Positron: positron.posit.co (read 2026-11-11)







