You need R 3.4.0 or later, the languageserver package (install.packages(“languageserver”)) and the REditorSupport R extension. After that, Ctrl+Enter in any R file sends code to an R terminal.
The extension also brings a workspace pane plus viewers for data frames and plots, which covers most of what a data science workflow leans on.
Plenty of people already have the editor. VSCode was the development environment of 75.9% of the 26,143 respondents who answered that question in the Stack Overflow Developer Survey 2025, while R was used by 4.9% of the 31,771 respondents who answered the language question. So the R crowd is a lot smaller, and it shows: R support isn’t bundled with VSCode. It arrives as an extension plus the languageserver package.
What does it take to run R in VSCode?
VSCode doesn’t come with R. It’s a general-purpose code editor, so the extension just hands your code to an R install you put on the machine yourself. The languageserver package supplies completion, signature help, hover and diagnostics.
The hard requirements are R itself (3.4.0 or later) and languageserver, plus the REditorSupport.r extension that ties them together. Everything else is a nice extra.
| Component | Role | Status |
|---|---|---|
| R (3.4.0 or later) | Runs the code | Required |
| REditorSupport.r extension | Terminal, viewers, language service client | Required |
| languageserver | Completion, diagnostics, formatting | Required |
| radian | Console with highlighting and completion | Recommended |
| httpgd or jgd | Plot viewer backend | Recommended |
| R Debugger extension | Breakpoint debugging | Optional |
The VS Code documentation lists radian and httpgd as recommended software, not requirements, and the extension README calls the R Debugger a complementary extension.
The extension bundles the sess package. It prompts you to install or update it on first use, so you never install it by hand, and the README doesn’t list it as a requirement.
Since version 2.1.0 the R language service lives inside the extension itself, which makes the old standalone r-lsp extension unnecessary.
On versions, vscode-R 3.0.0 requires VS Code 1.110 or later, according to the extension’s Windows wiki on GitHub (as of November 2026). The README agrees. The Marketplace listing and the documentation site’s Windows page still say 1.101 though, so go by whatever requirement is shown for the version you actually install.
How to set up R in VSCode step by step

Order matters here, because the extension goes looking for R and languageserver the moment you open your first script.
- Install R (3.4.0 or later) from CRAN. On Windows, let the installer write the R path to the registry.
- In R, run install.packages(“languageserver”).
- Install the extension from the VS Code Marketplace, or run code –install-extension REditorSupport.r.
- Create an R file and click Yes when prompted to install sess.
Install the interpreter, editor and extension
Platform differences mostly come down to compiling languageserver and finding R.
On Windows you only need Rtools for the development version of languageserver, the one installed with remotes::install_github. The CRAN release goes in with a plain install.packages call, as in step 2.
Linux is fussier. On Debian or Ubuntu, the languageserver README lists build-essential, libcurl4-openssl-dev, libssl-dev, libxml2-dev, libuv1-dev and r-base as system dependencies.
macOS and Linux each get their own installation page in the vscode-R wiki, linked from the VS Code R documentation.
Point VSCode to the right R path
If R came from CRAN with “Save version number in registry” turned on, the defaults work as they are.
If not, set r.consolePath to the R console executable that “R: Create R terminal” launches. r.executablePath is a separate setting, meant for background processes that need a different, vanilla R. Both go in your user settings, and opening settings.json from the command palette is the quickest way to add them.
Be careful with older guides. Many tell you to set r.rterm.windows to your Radian path. The extension still lists the r.rterm settings but marks them deprecated in favor of r.consolePath, and neither the current extension README nor the Windows wiki mentions them. Check any tutorial’s setting names against those two pages before you copy anything.
Switch the console to radian
radian is optional, and it brings its own requirements: Python 3.10 or later, R 4.2.0 or later built with a shared library, and an install through pipx install radian or uv tool install radian.
Sources disagree on its future. The VS Code documentation still recommends radian, while the extension README calls arf, a modern R console with multiline editing and vi or emacs keybindings, the successor to radian. radian’s own README mentions arf without describing it as a successor.
To use arf, set r.consolePath to “arf”. The README also recommends setting r.bracketedPaste to true for both arf and radian. Honestly, I’d stay on the default console until you actually miss the highlighting.
How to run R code in VSCode
Run “R: Create R terminal” first. After that, Ctrl+Enter sends the selected code, or the code at the cursor, to the active R terminal, and Ctrl+Shift+S sources the entire open file.
Ctrl+Enter sends your selection if you have one. With nothing selected, it sends the executable range at the cursor and then moves down a line. And if there’s no active R terminal, it opens one before sending anything.
With r.alwaysUseActiveTerminal turned on, code goes to whichever terminal is active instead.
The R terminal is a regular VS Code terminal that launches R, so everything you already know about how to open and arrange terminal panels still applies. The official R console is the default, and r.consolePath swaps in another one.
A caveat on shortcuts. The extension’s keyboard shortcuts wiki lists only suggested bindings that you add yourself in keybindings.json, such as ctrl+shift+f10 to restart the R terminal. Until you define them, they do nothing.
While you work, the R icon in the Activity bar opens the workspace viewer, which lists the objects in the global environment of the attached R session. The help pages viewer sits next to it, and you can install and remove packages from there too.
How to view plots and data frames in VSCode
View(x) opens data frames in the data viewer. Plots go through a separate viewer that supports jgd and httpgd backends, with a standard PNG or SVG fallback.
Data viewer and workspace viewer
View(x) opens paged, sortable, filterable grids for data frames, matrices, Arrow tables and polars data frames. Lists appear in a tree view. Filtering and sorting run in R across the full table, not just the visible page, and column pinning, reordering and “Fit width” are built in.
The workspace viewer works alongside it as an environment pane for global variables in the attached R session.
The plot viewer and its backends
| Backend | How it draws | Notes |
|---|---|---|
| jgd | JSON graphics device | Native vscode-R integration, tried first by auto |
| httpgd | SVG over HTTP and WebSockets | Plot history and resizing |
| standard | SVG (with svglite installed) or PNG fallback | Re-renders to fit the panel on resize |
Leave r.plot.backend at “auto” and it tries jgd, then httpgd, then the standard viewer. Setting it to “native” uses R’s configured graphics device without opening the viewer automatically.
The documentation contradicts itself here, which is annoying. The VS Code docs say the interactive plot viewer requires httpgd. The extension README and the current Plot viewer pages treat jgd and httpgd as equal backends, with auto preferring jgd. The Plot viewer wiki page also says it is no longer maintained and points to the documentation site.
Treat the README and the Windows wiki as current for extension 3.0.0. Installing httpgd from CRAN is the safe choice, because every source accepts it.
Earlier versions of the wiki documented limits for the old PNG viewer. With par(mfrow), the last page overwrites earlier ones. Only the last of several plot calls is captured, and grid-based plots may not update correctly. The current docs list no limits for the standard viewer, so test multi-panel plots before relying on it, or use jgd or httpgd.
How do code completion, linting and formatting work for R?
These features come from the languageserver package, not the extension. It provides completion, signature help and hover, publishes diagnostics through lintr by default, and formats code through styler by default.
Completion works without lintr or styler installed. Linting rules go in a .lintr or .lintr.R file and need lintr 3.3.0-1 or later. Formatting is customized through the languageserver.formatting_style option, which receives the editor’s formatting options.
If linting is new to you, it’s automated checking of source code for likely errors before it runs. The language server does this static analysis as you edit, after a short delay, and needs no active R session.
Some defaults worth knowing:
- r.lsp.formatting_backend: styler
- r.lsp.diagnostics_backend: lintr
- r.lsp.diagnostics_delay: 0.75 seconds
- r.lsp.max_completions: 200
jarl (diagnostics) and air (formatting) are alternative backends. You install them separately and select them through languageserver options. Pick one that isn’t installed and you get an error, not a fallback.
The wiki documents on-type formatting and says nothing about formatting on save. To set up autoformat in VSCode, use the editor’s own format-on-save setting.
Formatted help on hover needs the rmarkdown package, and Pandoc has to be installed separately unless RStudio is present.
How to debug R scripts in VSCode
Debugging needs the R Debugger extension (RDebugger.r-debugger) plus the vscDebugger R package. Running r.debugger.installOrUpdateRPackage installs or updates that package without leaving VSCode.
To launch, press F5 and select R Debugger. The default configuration starts a new R session and can run the focused file. To attach to a session that is already running, start R in a terminal, run library(vscDebugger), call .vsc.listen(), then use a launch configuration with “request”:”attach”.
The debugger covers the usual ground:
- Breakpoints, including breaking on errors
- Step, step in, step out and continue
- Watch expressions and call stack browsing
- A debug console that evaluates R code in the selected frame
- Package debugging through load_all from pkgload
It also has rough edges. Non-UTF-8 encodings cause problems on Windows, particularly since v0.5.0, and the README recommends R 4.2.2 or later. Packages with complex installs may not work with load_all, and packages with C code may cause problems. Variables in .GlobalEnv only show up after you click the “Global Workspace” dummy frame.
The project itself says it is “still under development.” Fine for stepping through analysis scripts. Test it on your own package before you count on it.
How to work with Quarto, R Markdown and Jupyter notebooks
R Markdown runs on the R extension alone. Quarto asks for more: the Quarto command line interface, its own extension, and the R extension for code execution. Jupyter needs a kernel for R on top of that. Pick one per project.
R Markdown
Chunks are highlighted, and commands run the current chunk or the chunks above or below it. Rendering needs Pandoc, and VSCode may need a restart before rmarkdown detects a fresh install.
Knitr evaluates from the document’s folder by default, unless you switch it to the workspace root. That bites data work in particular. A script that reads data with paths written for the project root fails when you knit from a subfolder.
Quarto
The Quarto extension adds language support for .qmd files, a visual editor, run cell, and render with preview. Ctrl+Shift+K previews the document and Ctrl+Shift+Enter runs the current cell.
A Preview Type setting decides whether output opens in a side-by-side panel, an external browser, or nowhere. Prose inside a .qmd file is ordinary Markdown, so a Markdown cheat sheet covers most of what you type outside the chunks.
Quarto’s own VSCode tutorial runs cells through Jupyter and contains no R or knitr notes. Check R chunk behavior in the Quarto documentation before you move an existing project over.
Jupyter
VSCode runs notebooks through the Jupyter extension and a kernel picker in the upper right of the notebook. The VSCode notebook page never mentions R, so the IRkernel instructions are the reference here.
- Run install.packages(‘IRkernel’) in an R console.
- Run IRkernel::installspec() to register the kernel for the current user.
- Pick the R kernel in the notebook’s kernel picker.
On Linux the packages must be built from source, with the ZMQ development headers installed first.
If R Markdown documents already exist in a project, leave them alone. Quarto makes sense once one format has to serve R, Python and Julia, and Jupyter mostly when collaborators already pass .ipynb files around.
How to keep an R data science project reproducible in VSCode
renv gives every project its own package library, so the dplyr or ggplot2 version in one analysis never changes another. Each project’s library lives in renv/library.
Start with renv::init(), which converts the project and creates the library, the lockfile and a project .Rprofile. Install or update packages as usual, then run renv::snapshot() to update the lockfile. Collaborators run renv::restore() to install the exact package versions recorded there, which is how they reproduce your environment.
The lockfile, renv.lock, is JSON. It holds the R version and repositories, plus one record per package with its version, source and hash. Installed packages link from a global cache, so each one downloads and installs only once.
Commit renv.lock, .Rprofile, renv/settings.json and renv/activate.R to version control. renv writes a suggested list into a .gitignore file for you.
The vscode-R packages need a spot in the lockfile too. The wiki’s default is a project script such as scaffolding.R that names languageserver, plus optional jgd, httpgd and vscDebugger. Leave sess out of that file, because the extension bundles and manages the matching version.
The wiki also describes a standalone library at ~/R/vscode-R, added through the r.libPaths setting, but notes that some users report it no longer works. Treat the scaffolding file as the default.
Per-project VSCode settings, such as a different r.plot.backend, belong in .vscode/settings.json inside the project folder. Open that folder as the workspace root so the lockfile and the .Rprofile sit where renv expects them.
renv tracks the R version but does not manage it. Operating system, system libraries and compiler versions sit outside its scope, and the docs suggest Docker for stable machine images. Pandoc isn’t bundled with rmarkdown either, so restoring rmarkdown doesn’t guarantee identical document rendering.
What goes wrong with R in VSCode, and how do you fix it?
Only a handful of failures have documented fixes. The table covers them.
| Symptom | Cause | Fix |
|---|---|---|
| Data viewer or plot viewer never opens | R session watcher is off | Enable the session watcher |
| R in WSL will not connect | VSCode runs on plain Windows | Start VSCode from inside WSL |
| rmarkdown does not detect Pandoc | Pandoc installed while VSCode was open | Restart VSCode |
| Leftover init.R line in .Rprofile | Snippet removed in extension 3.0.0 | Delete the line |
| htmlwidget fails to load | WebView blocks external network resources | Open it in an external browser |
All of the interactive viewers require the R session watcher to be turned on. For WSL, open VSCode from within WSL with the code command and your project directory.
Any .Rprofile line that sources the old ~/.vscode-R/init.R snippet should go, since the snippet was removed in v3.0.0. As for blank plotly pages, the WebView restricts access to external network resources for security reasons.
The debugger has its own path setting. If R is in neither the Windows registry nor PATH, set the matching r.rpath setting for your platform.
Don’t expect a troubleshooting page to rescue you. The extension’s FAQ wiki page lists one question, about Conda under remote development, and gives no answer. Its intro says solutions are mostly user-contributed and come from GitHub issues.
Is VSCode the right editor for R, or should you use RStudio or Positron?
VSCode fits when it’s already your editor or your work spans several languages. RStudio keeps deeper Sweave and R Markdown support, and Posit’s own FAQ recommends Positron to anyone new to R or RStudio.
| Editor | Strength | Gap |
|---|---|---|
| VSCode | Remote SSH, containers and WSL; huge extension set | Viewers, debugger and Quarto are separate installs |
| RStudio | Deeper Sweave and R Markdown support | R and the IDE share one process |
| Positron | Interpreter runs apart from the IDE | No .Rproj equivalent |
Positron runs the interpreter separately, so a crash in R won’t always crash the IDE. Jumping Rivers (2024) notes the reverse for RStudio, where everything runs in one R process and an R crash takes the IDE down.
Positron builds on Code OSS and accepts VS Code-compatible .vsix extension files. Stable releases began on July 2, 2025, and the current release is 2026.11.1-4 (as of November 2026).
VSCode’s clearest edge is remote work. The R extension supports development over SSH, containers and WSL, and working over SSH in VSCode covers the editor side.
AI assistance used to be a reason to pick VSCode. A 2024 InfoWorld guide told R programmers hoping to try GitHub Copilot that they would need VS Code, although RStudio had offered Copilot since version 2023.09.0.
That reason has weakened. Positron Assistant offered GitHub Copilot inline completions in its July 2025 preview, and according to Posit’s documentation, Posit AI, the service behind Posit’s own assistant for RStudio, reached general availability in April 2026. Posit Assistant replaced Positron Assistant in Positron’s July 2026 release. If Copilot is still the goal, here is how to use GitHub Copilot in VSCode.
If R Markdown or Sweave depth is your daily need, RStudio is the better pick. If you’d rather not assemble anything, Positron ships the Quarto command line tool and extension out of the box.
VSCode suits people who already know their way around it. Everyone else spends some time on setup first.
R in VSCode FAQ
How do I attach VSCode to an R session that is already running?
Run R: Attach External R Session (Copy command) from the command palette, then paste the copied source() command into the target R session. This route is meant for self-managed terminals such as screen or tmux on Linux and macOS, and it installs or updates the bundled sess package when needed.
Can I install and manage R packages from inside VSCode?
Yes. Installing and removing packages is among the extension’s listed features, and install.packages() in the R terminal works as usual.
In an renv project, run renv::snapshot() afterward to update the lockfile.
Is the R extension free?
Yes. The VS Code Marketplace lists it as free, it’s published by REditorSupport, and its repository carries an MIT license. The VS Code R documentation points to it as the R extension.
Can I develop R packages in VSCode?
Yes, with some assembly. The extension adds package development commands built on devtools.
The wiki only suggests keyboard shortcuts, such as ctrl+shift+b for install and ctrl+shift+t for test, so you define them yourself in keybindings.json.
Does VSCode run RStudio add-ins?
The R extension supports running RStudio add-ins. The vscode-R wiki has a dedicated RStudio addin support page, so check there for specifics before you depend on one.
Which extension registry should I install it from, the VS Code Marketplace or Open VSX?
Either one works. The README lists the VS Code Marketplace and Open VSX as install sources, so an editor without Marketplace access can still get the extension from the Open VSX Registry.
Moving an Existing RStudio Project into VSCode
The order matters when you carry an RStudio project over.
- Open the folder holding renv.lock as the workspace.
- Activate the renv environment, then start the R terminal.
- Knit one document and check its data paths.
The extension prompts to install sess into the active library, so renv must be active before the first R terminal starts. Otherwise the helper package lands in the wrong library.
This sequence was verified on November 21, 2026 against the current extension documentation. A release that changes the plot backend or raises the minimum VSCode version would change it.
Once the project runs, a VSCode workflow cheat sheet speeds up the editor shortcuts you reach for daily.
- How to Choose a Digital Transformation Consulting Partner - November 30, 2026
- Is Notepad++ Safe? Official Download, Updates, CVEs - November 29, 2026
- How to Evaluate an AI Code Reviewer on Your Own Pull Requests - November 29, 2026



