I recently had cause to take a beginners course in R - a language I'm fairly familiar with.

One of the other students had never used it before, so we were buddied up in order for me to show them the ropes.

The first lesson of R is always the same. Read a CSV, manipulate it a bit, draw a graph. We did it all without much fuss - and a graph appeared on screen. Nifty!

"I don't get it," the student said, "Why wouldn't you just use Excel for this?"

To a programmer, it seems obvious - but it's a fair question! If you have a static set of data, you can drag your mouse over it, hit a few buttons, and a graph appears. Much easier than wrestling with esoteric syntax in a text-based interface. This isn't a Koan - where the student becomes enlightened at the end. It's a tricky question to answer. Here are the reasons I gave - feel free to add your own.

Visibility

How do you see the code inside an Excel document? How do you tell exactly what is going on? You have to go clicking through cells, or reverse engineer what settings a graph has.

With something like R, you automatically have all the code visible in front of you. Reading through the code in a linear fashion is possible. You can trace exactly what the code is doing without having to worry about whether there's some code hidden in cell Z44.

Track Changes

Related to the above, it's hard to visualise what changes have been made to an Excel document. I don't know any way to easily see how a formula has changed. With R and Git (or any other version control system) you can see exactly what has changed from one version to the next.

Repeatability

Typically, a user draws a graph on a single Excel document. If you want the same graph of a different data set, you're out of luck. You can copy the data from one Excel sheet into another - but there's no way to easily copy a bunch of manipulations and graph configurations to another document.

With R, you just change read.csv("1.csv") to read.csv("2.csv") and the exact same calculations are run on two different data sets.

Batch processing

Related to the above, you can read every CSV in a directory and produce a graph for each of them. You can read data from an API and run the same process on it that you did yesterday.

Extensibility

Excel has a wide range of graphs available - but R has more. Excel can do basic analysis - but R can do extensive, complex analysis. Excel has some decent tooling - but R has thousands of libraries which can do a bewildering array of clever stuff.

What else?

Those were the advantages that I could think of on the spur of the moment. Perhaps you can think of more.

But what I learned was that it is decidedly non-obvious why a user would want to use something like R or Python when Excel (seemingly) covers all the basics.

6 thoughts on ""Why do we use R rather than Excel?""

  1. Excel is not benign. There are all sorts of down sides to using it for stuff it was never designed for.

    https://www.bbc.co.uk/news/technology-54423988

  2. keithb says:

    http://www.eusprig.org/stories.htm

    The news stories above will provide some examples of why a script producing a report is safer than sending a spreadsheet around! The same organisation did a paper some time ago claiming a 5% error rate on spreadsheet entries.

    I see the spreadsheet as a sketchbook and a script as a finished work (possibly in oils:-)

  3. Joseph E Dante says:

    All the things you describe R can do can also be done easier in excel using VB.

  4. I've led courses on spatial data analysis and mapping using Excel+QGIS, as well as using R, sometimes covering both in one course. Its definitely hard to convince students the value of R when they are used to being able to see and interact more directly with data.

    I usually explain that using Excel + QGIS is like baking a cake yourself. You do all the steps yourself, and if you realize at the end you forgot to add eggs, you have to throw the cake out and start all over again.

    Using R, on the other hand, is like writing a recipe. If you forgot a key ingredient, fixing the recipe is as simple as adding it to the list of ingredients. The catch is that you hand the recipe to a very stupid and literal chef, so you must specify everything in the recipe perfectly.

    1. Joe Schmoe says:

      value of R when they are used to being able to see and interact more directly with data.

      Does R not have an easy to visualize repl like Jupyter Notebooks for python? It's pretty direct interaction with great visibility, at least with pandas and matplot.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 12,196 other subscribers.

Email Address

Search for:

Explore The Archives

2021
January 31 postsFebruary 28 postsMarch 31 posts
April 30 postsMay 31 postsJune 30 posts
July 11 postsAugust September
October November December
2020
January 31 postsFebruary 29 postsMarch 31 posts
April 30 postsMay 31 postsJune 30 posts
July 31 postsAugust 31 postsSeptember 30 posts
October 31 postsNovember 30 postsDecember 31 posts
2019
January 31 postsFebruary 12 postsMarch 17 posts
April 12 postsMay 12 postsJune 10 posts
July 7 postsAugust 5 postsSeptember 6 posts
October 14 postsNovember 30 postsDecember 17 posts
2018
January 8 postsFebruary 4 postsMarch 6 posts
April 14 postsMay 5 postsJune 6 posts
July 6 postsAugust 13 postsSeptember 14 posts
October 8 postsNovember 30 postsDecember 4 posts
2017
January 12 postsFebruary 9 postsMarch 8 posts
April 4 postsMay 10 postsJune 5 posts
July 5 postsAugust 6 postsSeptember 3 posts
October 4 postsNovember 30 postsDecember
2016
January 10 postsFebruary 10 postsMarch 11 posts
April 9 postsMay 8 postsJune 9 posts
July 6 postsAugust 9 postsSeptember 4 posts
October 2 postsNovember 30 postsDecember 14 posts
2015
January 8 postsFebruary 11 postsMarch 10 posts
April 4 postsMay 9 postsJune 3 posts
July 7 postsAugust 9 postsSeptember 10 posts
October 2 postsNovember 30 postsDecember 4 posts
2014
January 13 postsFebruary 13 postsMarch 14 posts
April 14 postsMay 7 postsJune 7 posts
July 9 postsAugust 5 postsSeptember 5 posts
October 1 postNovember 30 postsDecember 20 posts
2013
January 25 postsFebruary 17 postsMarch 15 posts
April 18 postsMay 11 postsJune 14 posts
July 6 postsAugust 14 postsSeptember 6 posts
October 4 postsNovember 30 postsDecember 14 posts
2012
January 14 postsFebruary 8 postsMarch 13 posts
April 15 postsMay 10 postsJune 16 posts
July 8 postsAugust 8 postsSeptember 6 posts
October 6 postsNovember 30 postsDecember 31 posts
2011
January 13 postsFebruary 11 postsMarch 11 posts
April 12 postsMay 8 postsJune 8 posts
July 6 postsAugust 5 postsSeptember 11 posts
October 7 postsNovember 30 postsDecember 17 posts
2010
January 6 postsFebruary 15 postsMarch 12 posts
April 13 postsMay 4 postsJune 3 posts
July 15 postsAugust 8 postsSeptember 11 posts
October 9 postsNovember 30 postsDecember 9 posts
2009
January 1 postFebruary 5 postsMarch 3 posts
April 7 postsMay 12 postsJune 8 posts
July 10 postsAugust 10 postsSeptember 12 posts
October 22 postsNovember 31 postsDecember 15 posts
2008
January 2 postsFebruary March 2 posts
April 3 postsMay 2 postsJune
July 1 postAugust 3 postsSeptember 1 post
October 3 postsNovember 2 postsDecember 1 post
2007
January February March
April May June
July August September
October November 4 postsDecember 5 posts
2006
January February March
April 1 postMay June
July August September
October November 1 postDecember
2005
January February March 1 post
April May June
July August September 1 post
October November December
2004
January February March
April May 5 postsJune 3 posts
July 1 postAugust September
October November December
2003
January February March 2 posts
April May June
July August September
October November December
2002
January February 1 postMarch
April 3 postsMay June
July August September
October November December
2001
January February March
April May June
July 1 postAugust September
October 1 postNovember December
2000
January February March 1 post
April May June
July August September
October November 1 postDecember
1999
January February March
April May June
July August September 1 post
October November December 1 post
1995
January February March 1 post
April May June
July August September
October November December
1987
January February March
April May June
July August September
October November December 1 post