Live data from Hacker News

Why do we use R rather than Excel?

shkspr.mobi

31–40 of 266 posts

Re: Why do we use R rather than Excel?

#31
post #23

IMO this really asks the question: Why is there not a code view for an excel spreadsheet? I get that some of the basic operations probably create expressions that are too wordy / very "specific data" intensive. That is, if you took the first step and just did your best to create that code view it would have a lot of stuff conditional on specific things. But it's the next step that gets interesting. Now that you've go…

You might want to try out Power Query (get & transform). Step-by-step repeatable transformations where the UI records steps and writes code in the background. Almost exactly what you're talking about, and comes out-of-the-box in the last few versions.

Cool! Next time I'm opening up excel, I'll give it a look.

Re: Why do we use R rather than Excel?

#32
post #20

A while ago, there was a job offer in my area to automate Excel tasks using Python. The thing was posted time after time by several recruitment agencies, for almost a year. Just thinking how expensive that process must have been answers the question.

I spent a big part of my early career automating Excel, initially via VBA, then Interop (.net), then later via the OpenXML libraries.

I actually really enjoyed it, there's something a bit magical about taking a task that takes somebody hours to do, and putting it under a single button press, or even running it overnight and having everything ready for them when they start work the next day.

Re: Why do we use R rather than Excel?

#33
This week I got a bit more familiar with R while adding it as a scripting language for a data IDE I'm working on (it already supported other languages).

It is a very hard language and community to get into! The documentation is very sparse. Library documentation is published as PDF (I guess?) and also very sparse. The default `print` behavior is pretty hard to understand. It's 1-indexed and it took me a while to realize every time I think `array[1]` I should write `array[[1]]`. I can't tell the difference between `My guess is that it was probably a great language at some point but is way behind other numeric scripting languages like Julia or Matlab in terms of community attention and language ergonomics.

I know it's highly used but other than legacy reasons I'm not sure why you'd want to learn it over Julia.

I'm also curious to investigate how the aspects I'm critical of differ in Octave.

Edit: totally fair, 1-indexing shouldn't have been a "critique". Lots of languages do that.

Re: Why do we use R rather than Excel?

#34

IMO this really asks the question: Why is there not a code view for an excel spreadsheet? I get that some of the basic operations probably create expressions that are too wordy / very "specific data" intensive. That is, if you took the first step and just did your best to create that code view it would have a lot of stuff conditional on specific things. But it's the next step that gets interesting. Now that you've go…

>Why is there not a code view for an excel spreadsheet?

The MS Excel grid with code underneath each cell is declarative (not iterative loop) formulas so what would the ideal "code view" be?

Because of the architecture based on formulas, Excel does already have "Show Formulas" option (keyboard shortcut Ctrl+`) and "Trace Precedents" and "Trace Dependents".

For Excel iterative code like VBA Macros, it does have a typical "code view" (keyboard shortcut Alt+F11).

Re: Why do we use R rather than Excel?

#35
* R scales to big data, runs on servers * Excel is full of foot guns - e.g. errors in ranges are hidden unless you dig in * R you can write test suite and run it in CI * R integrates nicely with cloud services via reticulate * R’s Shiny is great for interactivity and deploys to the web * R and git support you to collaborate - PR reviews etc * automatable - run analysis in a pipeline when data arrives and publish results on the web * white box / transparency - who knows what Excel does exactly in some of its functions * data science - Excel doesn’t do machine learning, NLP

Re: Why do we use R rather than Excel?

#36
post #34

IMO this really asks the question: Why is there not a code view for an excel spreadsheet? I get that some of the basic operations probably create expressions that are too wordy / very "specific data" intensive. That is, if you took the first step and just did your best to create that code view it would have a lot of stuff conditional on specific things. But it's the next step that gets interesting. Now that you've go…

>Why is there not a code view for an excel spreadsheet? The MS Excel grid with code underneath each cell is declarative (not iterative loop) formulas so what would the ideal "code view" be? Because of the architecture based on formulas, Excel does already have "Show Formulas" option (keyboard shortcut Ctrl+`) and "Trace Precedents" and "Trace Dependents". For Excel iterative code like VBA Macros, it does have a typic…

An ideal "code view" of Excel could be a declarative programming language that states the relations that hold between cells, for example a logic programming language such as Prolog or Datalog, using constraints to express the relations.

Re: Why do we use R rather than Excel?

#39
For me, it comes down to the right tool for the job. Excel (strictly speaking, spreadsheets) is very powerful. It is a grid-based visual programing environment that has an interface simple enough to be groked by its original target audience: accountants and file clerks.

What that means to me is that I use excel for "toys" (small data set analysis, rough charts) and ephemeral-yet-shared lists where it is easier to say "evening batch tab, line 3" to communicate which job needs to be updated than try to communicate the same thing in a written request or pull a database table report.

I use R where I need more power: automated reports, automated statistics, and more complex analysis where the paradigm of textual code fits better than the paradigm of a 2D grid. I teach R (or python) when I want to give someone more reproduceable tools than a "magic" spreadsheet that, under the covers, is really a contraption held together with sticky tape and positive thinking.

We can, and should, teach both. Ideally side-by-side with a constant stream of "why are you doing task X this way?" that is largely missing from formal education.

Re: Why do we use R rather than Excel?

#40
If you need to do something once, use a GUI (Excel).

If you need to do something ten times, use hotkeys and shortcuts.

If you need to do something a hundred times, write a script (R).

I usually use the command line as the example for why writing code and scripts are better than the more intuitive and lower-learning-curve GUIs.

If I want to move a file from one folder to another then I just drag it across. Easy.

If I want to move a thousand files from one folder to another, I will benefit from learning `CTRL-A` or shift-clicking (slightly more obscure than the 'intuitive' drag each file across individually or drag a large box around them all to select them).

If I want to move a thousand files beginning with 'UTR-77' and ending with '.csv' then I would benefit from learning `mv UTR-77*.csv $folder`, but I could still do it manually if I didn't know that was an option.

If I want to move a thousand files beginning with 'URT-77' to another folder at a moment's notice or at Thursday 1am, then the only options I really have are scripting.

I almost feel like before people learn the 'basic' stuff as outlined at the beginning of the article, they should be shown some 'magic' that is only really possible with scripting so that it's clear from the outset why you wouldn't 'just use excel'.

Post reply on HN