Work with R in Visual Studio
Applies to: Visual Studio Visual Studio for Mac
This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
R is a highly extensible language and environment for statistical computing and graphics. It's distributed for free under the GNU General Public License, enjoys strong community support, and is known for its ability to produce publication-quality plots including mathematical symbols and formulae. You can learn more about R at r-project.org and An Introduction to R.
R Tools for Visual Studio (RTVS) is a free, open-source extension for Visual Studio 2017 and Visual Studio 2015 Update 3 (or higher), released under the MIT license. (A second open-source component called RHost, which links to the R interpreter binaries, is released under the GNU Public License V2.)
RTVS is presently supported only in Visual Studio 2017 on Windows and not Visual Studio for Mac. It is not available for Visual Studio 2019.
To experience R in Visual Studio:
- Install the R Tools.
- Follow the Getting started guide, as well as the Samples and Getting Help articles.
Then follow the links below to learn more about R-related features as well as the general capabilities of Visual Studio itself.
|General Visual Studio Documentation
|Visual Studio project system
|Organize and manage related files in a convenient structure, and take advantage of useful templates for items such as R code, R documentation, R Markdown, SQL queries, and stored procedures. Also enjoy the package manager and SQL Server integration.
|Solutions and Projects in Visual Studio
|RTVS can bind to local and remote workspaces, allowing you to develop R code locally with smaller data sets, then easily run the code on more powerful cloud-based computers with much larger data sets.
|R Tools options
|Control various aspects of RTVS.
|Options dialog box
|Rich editing, IntelliSense, and code snippets
|Includes syntax coloring, IntelliSense across all your code and libraries, code formatting, signature help, Go to Definition, Find All References, code snippets, and more.
|Features of the code editor
|R Markdown documents help you share your data results, with integrated R code inside markdown code blocks.
|Provides a full REPL experience for R with the ability to easily run code in a source file in the interactive window.
|Plotting is an integral part of the R experience, and RTVS supports multiple, independent plot windows, each with their own history and the ability to move plots between windows. Plots can be saved to bitmap and PDF files, or copied to the clipboard as a bitmap or metafile.
|Examine variables in the global or package-specific scopes, with the ability to view sortable tables and export to CSV.
|Includes integration with the interactive window.
|Debugging in Visual Studio
Also see Frequently asked questions.
For videos on how to use R Tools in Visual Studio, see R Tools videos.
Send us your feedback
GitHub issues: The best way to reach the RTVS team is by filing an issue on GitHub, or by using the R Tools > Feedback menu.
Send a Smile / Frown: The R Tools > Feedback menu is a quick way to send feedback and attach RTVS log files to assist in the diagnosis of your issue. (Logs are written into %temp%/RTVSlogs.zip in case you want to send them separately.) Logging is disabled if you've opted out of Visual Studio telemetry through the Help > Feedback > Settings menu command, or during installation.
Email: You can send direct feedback to the team at rtvsuserfeedback (at) microsoft.com.