

Some simple shortcuts like the pipe operator doesn’t work out of the box, so adding a shortcut for “%>%” or “|>” depending on your preference can be done using the following method: To eliminate any potential errors/code not work, you must make sure the R path is specified in the VSCode preferences (cmd+shift+p on mac) and search for R path.įinding the path is simple, open R and type:Īnother somewhat major tweak you would want to do to the editor:

You can now start working with code but there are potentially times you could run into errors while running your code. Optional: You can install a better terminal alternative like radian, a debugger and a better plot-viewer like httpgd because the builtin plot-viewer for VSCode isn’t a particularly good one. install the R extension from the marketplace ( R - Visual Studio Marketplace).install the `languageserver` package for R (install.packages(“languageserver”).Now that we’re done with that, lets get into some of the details: InstallationĪssuming you already have R installed on your system, Installing VSCode and R is very straightforward RStudio is an outstanding piece of software and has never given me any major problems during my workflows, this was just an experiment to find a one-size-fits all code editor/IDE. I decided to try VSCode for R because I wanted to see if I could use a single code editor for everything I do. For everything else (Python, Jupyter, HTML, CSS, JS,etc ), I tend to use VSCode. I am somewhat of a intermediate programmer who doesn’t use R as much as some people but whenever I do, RStudio is my preferred editor of choice. So, I will not be talking a lot about RStudio for that reason, but going into the strengths and weaknesses of VSCode compared to RStudio.įurther, this is a very brief overview comparing the community (free) versions of both editors, I cannot speak to the R-Studio paid editions. This writeup is for people who are very familiar with RStudio and want to see how the two compare.

RStudio is the preferred IDE/Editor for running R code for most people, but VSCode has rapidly become one of the most popular code editors for a huge number of other languages.
