Search code examples
rvisual-studio-codeanaconda

Using R in Visual Studio Code with conda environment


I would like to use the R environment I installed with conda inside Visual Studio Code (on Macos). First I installed R with conda. But how do I use/activate the environment in Visual Studio Code? In the settings I can't find the equivalent to "Python: Select Interpreter" or "python.venvPath" Thanks!


Solution

  • R support in VSCode is handled by a 3rd party extension. The most popular one is R by Yuki Ueda and there is also R Tools by Mikhail Arkhipov

    For both of these, you can change the R interpreter to use in the settings.

    However, there is no built-in support for Anaconda, mostly because it isn't that popular or necessary in the R community. Most people use the standard R installation instead and most help resources are written for that type of installation: https://cloud.r-project.org/bin/macosx/