Today I presented a webinar for BlueGranite called Exploring R Tools for Visual Studio. It provides a glimpse into some of the benefits of RTVS, considers when you may want to use RTVS versus RStudio (or use both), and provides a tour and demonstration of RTVS in action.
This blog post of eight items I want to share is not a recap of the webinar content. It’s simply a short personal list that I compiled as I was preparing for the webinar. Some of it is good and shows the benefit of RTVS. Some of it shows some needed improvements either for RTVS or for me as a developer. Overall though, I now use RTVS more regularly, whereas I was on the fence prior to writing this blog post and subsequently preparing content for BlueGranite’s webinar.
View the webinar recording from BlueGranite.
Slides are also available upon request.
Onto the list!
1. I now use RTVS for any work pertaining to SQL Server R Services
The SQL Stored Procedure with R template is wildly convenient and saves me a lot of time writing out R stored procedures. You will not find me doing this by hand in Management Studio anymore. The template is actually three files: one for your R script, one for your SQL input query, and one that combines them into the final stored procedure. You can then publish it directly to your database from RTVS if desired.
2. The RTVS code snippets are great for working with both CRAN R and Microsoft R / R Server
For a coder like me who is inconsistently using functions or forgetful in general, or for anyone learning Microsoft R Server, the RTVS snippets are very beneficial. R Server snippets are those prefixed by “mrs-“.
3. R Markdown *may* render differently when knit using RStudio versus RTVS
If not, at least RTVS does not knit flexdashboards created using R markdown in the same way that RStudio does. I opted to use an existing markdown .rmd file that I had available, and the output was not the same. This simple quake demo that was created using RStudio did not render as a dashboard and instead was a simple HTML page with all of the content.
4. Use the R History window
I cannot tell you why I never really used the History window in RStudio. Perhaps I liked hitting the up arrow multiple times to access all of my prior console input. In any case, I started using the comparable R History window more frequently in RTVS, and it has influenced how I also work with RStudio.
5. The default internal browser option in Visual Studio is not great with R’s HTML content
Under the R Tools menu, select Options and change the HTML pages browser option to External. As a heavy user of various HTMLwidgets, and Leaflet in particular, I have never been able to get my R HTML content to display well inside Visual Studio. It shows an ActiveX warning, and clicking Allow on that never renders my content properly. Instead, I use my external default browser without issue. Oddly enough, there is a separate option for Markdown preview browser that already defaults to External.
6. Workspace content is not saved by default when closing Visual Studio, but there’s also an Option for that
While in R Tools + Options, you may want to set the option for Save workspace when project closes. The default is NO, but there is also YES and ASK.
7. The Export to Excel icon is actually an export to CSV button
There’s an icon that looks a lot like an Export to Excel button in the Variable Explorer window. Don’t be fooled though as it is actually an Open in Microsoft Excel or another app registered for CSV files button. If you use this feature and use another text editor besides Excel to commonly work with CSV files, make sure that alternative application is setup as your default in Windows.
8. The Data Science Settings layout is almost exactly like RStudio’s default layout, and that’s a good thing
If you find yourself having to switch between functionally similar applications frequently, it’s often disorienting if the same functionality is presented one way in one application and completely different in another. Switching between RTVS and RStudio is similar. I do not think this is a situation where RTVS is being a copycat for the sake of it, but rather because it is better for the developers who will be using RTVS if the layout is similar to something they already may work with. I use the Data Science Settings layout in Visual Studio. I probably could not use RTVS as easily without it.
Thanks for the great writeup! A couple of points:
1. Default internal browser is a problem. What you’re observing is the fact that the only web browser that we an light up inside of Visual Studio is the system installed IE (NOT Edge). IE is “sort of” an HTML 5 browser, but there are key areas where the compatibility is not up to par. I use external, partly for this reason, and partly because I prefer ALT+TAB to go between docs and RTVS.
2. Good point about Excel. We should think about a reasonable way to call that distinction out without being overly wordy or verbose in the UI.
3. Do you have any feedback about snippets i.e., what’s missing that we should add?
John, thank you for the comments and for all of the work that you and your team have put into RTVS! When I have some time to compile some feedback and potential snippet requests, I’ll add them to the Issues list on the RTVS GitHub repo. Can’t wait to see how RTVS evolves!
Great webinar. I am just starting out using Microsoft R Services in SQL Server 2017, and this is a great help.
Glad to hear it’s a helpful resource!