Why does RTVS open Notepad?!?

For the past few weeks, I’ve been going through the Mastering Software Development in R specialization on Coursera.  After Matthew Renze mentioned R Tools for Visual Studio (RTVS) during his workshop at CodeMash, I had to see what this was about.

As I have been going through my courses – which use swirl() – I have been looking at how things work, comparing RStudio to RTVS.  One of the things that was maddening for me was going through one of the courses in RTVS and having R files open in Notepad.  Notepad?!?  RStudio wasn’t doing this, so I was even more frustrated.  I could also open R files with Visual Studio right from the file system, so the file association was already in place.  This didn’t make sense.  However… RTVS is an open source project, as is swirl().  So I spent tonight looking at code in GitHub.

After poking around swirl(), I found something that led me to try the following command:

getOption("editor")
[1] "notepad"

Wait… how?! Why?!  Poking around some more, I realized that R has its own profile file – similar concepts to the PowerShell profile file and the bash profile file.  I found this post on Customizing Startup (Quick-R) leading me down the right direction.  With a bit of trial and error and finding this closed issue in the RTVS repo, I moved my .Rprofile file to Documents, and RTVS was happier.

Before changing the editor, I wanted to make sure that I could call the editor – so that when I change it, I could make sure it changed.  This is the command I tried, with the sampleTest.R being in my working directory:

edit(file="sampleTest.R")

Sure enough, this loaded my sample file in Notepad.

Using the sample Rprofile.site file from the Quick-R site as a guide, I edited my default editor to the full path to Notepad++.  This looks like it could be the right direction.

Calling the same command from above:

edit(file="sampleTest.R")

Now this loads in Notepad++, which means I have syntax highlighting.  (I would have pointed at Visual Studio Code, but I’m on the one laptop that didn’t have it installed just yet.)

Next goal: How to tell the R Interactive to open the R files in the current instance of Visual Studio….

Adventures with R…

About a week and a half ago, I started going through the R specialization on Coursera.  These are some of my observations.

Reminders of my Past

As I work in RStudio and go through lessons on data tidying, querying for values, and creating functions, I am reminded of some of the courses I went through in my past.  I am calling functions – such as correlation – that I (vaguely) remember learning about in my statistics class.  A lot of my interactions with R remind me of the days of working on engineering homework in Matlab.  I’m also finding that the language makes a lot of sense to me because it has elements of object-oriented programming – akin to the C# and Java that I teach at The Software Guild – and functional programming – with concepts like pipelines and chaining functions, which I liken to some of my PowerShell adventures.  It’s been quite an adventure so far.

Preparedness Going In

I’ve been curious about data science for awhile.  Catching Matthew Renze’s Practical Data Science with R workshop at CodeMash encouraged my curiosity out more.  Between January and March, I dreamt of data science stuff and had ideas popping into my head – especially since NASA’s International Space Apps Challenge is coming up in April, and I’d love to show my NASA friends what I’ve been playing with, hopefully using some of their datasets.  When it comes to querying data, I have a solid background in that too – having worked with multiple RDBMSes and worn the database administrator hat in my past.  Finally, I realized that I was prepared enough – between my solid understanding of programming languages and paradigms and having been exposed to R in the workshop – that I had better follow my dreams and take a course to keep me on the right path.

Current Status

Tonight, I hit an achievement – I finished Course 1 of the R specialization.  Yes, it’s a 4 week course.  Yes, I went through it in a short period of time – but my preparedness really helped in this case.  The only road block I had in this first course was when it came time to use statistical functions and not remembering what they meant or represented.  But after reading and plugging away at it for an hour or so, it all started coming together.

I signed up for Course 2, which starts on Monday.  I’m already through the Week 1 material there, and I’m having fun creating functions.  As I was writing some of my code, I laughed because I recognized R’s syntax and thought “ah… anonymous functions… much like my lambdas in C# and Java….”  It’s good to be adding another language to my toolbelt.

Also, while I mentioned RStudio above, I also find myself yearning to get back into Visual Studio at times.  So when I get tired of RStudio, I switch back to R Tools for Visual Studio 2015.  The only downfall I’ve run into with that is that Notepad is the editor that comes up when swirl() opens a temporary file for me.  I need to eventually sit down, look at configuration, and find out if I can either set Visual Studio or Notepad++ as my R editor for swirl() when I run it in VS.  (And no, I haven’t checked Visual Studio 2017 for the R tools yet…)

Overall, though, I am thrilled to be playing with data again, and R has captured my attention.

The Work/Life/Community Tightrope Walk…

With work/life balance being a questionable topic for some, I figured I would share what it’s like here.  If you haven’t seen me in the community in awhile, there’s a lot going on at work and also need to spend time with my family every now and then as well.

Between now and the beginning of May, if I seem a little chaotic, it’s because I’m walking on a tightrope as carefully as can be.  The work/life/community tightrope is crazy right now!

Work

  • Onboarding a new team member next week
  • Working on things for a big launch on 4/1
  • Helping prepare for a new cohort on 4/17
  • Eventually preparing for another new cohort on 5/8

Life

  • 2 Birthdays in beginning/mid-April
  • Easter

Work – Cleveland Tech Consulting

Community

I keep “doing” and then look back later wondering “how?!?”  Such is the life of Sadukie!