DataClassroom

View Original

A Bridge to R

The R Project is fantastic. With it, you can do virtually any data visualization or analysis task - and it is free and open source. Mastering R is surely a goal for any student who is serious about science and statistics. (Unless you’re a Python fan - more on that in a later post…)

There’s just one problem: Getting started

It’s probably not controversial to say that learning to code in R can be pretty intimidating for many.

  • The syntax is, well, different from most common programming languages.

  • When something doesn’t work, it can be hard to work out what has gone wrong.

  • The huge number of (free!) packages means that there are often several ways to solve a given problem.

  • The documentation can be terse and patchy.

These are problems that can afflict even the most ardent of graduate students.

In a larger university undergraduate course environment, these problems can be exacerbated by others:

  • Students having various levels of familiarity with coding

  • Varying targets - not all students may be going on to advanced courses

  • Limited time to spend learning a whole new methodology

So what’s the Bridge?

Let’s take a step back.

With DataClassroom, our standard functionality provides easy, interactive point-and-click ways to achieve high-quality graphing and annotations.

And with our Graph-Driven Test, it’s straightforward to perform a relevant hypothesis test, for example the above data can be analyzed with an ANCOVA test to give a result like this:

So that’s great - and means that students can get their results and continue with their analysis and conclusions. For those with our College Student license (DataClassroom U) there’s a further option:

This innocuous button will then generate two chunks of annotated code for R, which can:

  • generate the same, annotated graph, and

  • run the same hypothesis test as DataClassroom

We all know that a common starting point when beginners are trying to get some code like this to work is to: Google the problem, find some page with some example code, copy the code, and start hacking it to get it to do what they actually want. This is clearly non-optimal and time consuming, as such code is often not annotated, may not be completely relevant or be missing some detail, or be using a different library than the last piece of such code they found.

It’s rarely a great learning experience, but it usually works in the end. However, we think our Bridge to R feature has significant advantages, as it:

  • Generates well-commented code

  • Uses consistent R libraries

  • Makes a visualization just the way you wanted (which can then be tweaked)

  • Provides the same hypothesis test results as DataClassroom, confirming the validity of the code

Actually run it in R

We didn’t stop there. The student can of course copy the code, download the dataset and then fire up R on their own laptop to check it out.

But we also provided this button:

This gives the instant gratification of seeing the code actually run in R, and provides the output right there on your screen. You don’t even need to have R installed, as it gets run on a DataClassroom server. But you get to see exactly what R outputs, in all its slightly-idiosyncratic glory:

Yup - go ahead and compare it with the standard DataClassroom output above! It should match, at least to a reasonable number of significant figures…

What do people say about this?

One of our first customer responses was “is that even possible?” which was nice. Fortunately the answer is yes, and we can generate R code for all our graphs and hypothesis tests - check out the feature list in our User Guide here. Other comments have included:

“This will be so helpful to my classes where students come in with so many different comfort levels with coding.”

“I wish I had had this when I was first learning stats and R!”

“This would be great for my intro course where we are introducing students in the class to working with data and some of those students will go on to take upper level courses where they will need to work in R. This allows them to get their feet wet with coding in a way that isn’t intimidating.”

Check it out!

If this sounds like what you’ve been waiting for, register for a free trial of DataClassroom U or check out the website, have a browse through the searchable User Guide, watch one of our videos or get in touch and see how we can help!

Already have a Teacher or School license?

K12 teachers with a full Teacher or School license can already try out the DataClassroom U features, by setting your Profile appropriately. See how to do that here.

Attribution: The R logo is the property of the R Foundation and is reproduced here under license.