Live data from Hacker News

Why do we use R rather than Excel?

shkspr.mobi

261–266 of 266 posts

Re: Why do we use R rather than Excel?

#261
post #70

Earlier quoted context omitted.

I've always thought that every highschooler should be taught the basics of programming with an easy language like Python instead. That really is a superpower in a lot more contexts.

They are in the UK though. I feel like Python is a poor choice these days though. Typescript would make more sense.

Yeah, typesafety alone makes a HUGE difference.

Personally, I'd go to something like haskell or f# though, because of a even better type system IMO.

Altough, for learning it, typescript is probably easier and more applicable in the real world.

Re: Why do we use R rather than Excel?

#262
post #209

Earlier quoted context omitted.

EDIT: i gotta admit, you sound like you've got more experience with teaching R than me. so perhaps my opinions here are a bit strong for what they're based on, i.e. tutoring a couple of non-programmer friends and my own learning process. still... > My experience is that this weird evaluation order stuff is only confusing for students with a lot of programming experience who already expect nice lexical scope fair poin…

It's true that if you write code that is pure and error-free then you will never bump up against R's strangeness. But try out this bit of base R: > hello = function(cats, dogs) { return(cats) } > hello(100, honk) # where honk has never been defined > hello(100, print("hello!")) > hello(100)

yeah, the intersection of lazy evaluation and side-effects (incl. errors/exceptions) gets confusing, you definitely have to be there to help the student out of a jam. but i think it's useful to start out pretending R follows strict evaluation (because it's natural[1]) and then, once the student gets their bearings, you can introduce laziness.

---

[1] well, not "natural", but aligned with how math stuff is usually taught/done. in most cases, when asked to evaluate `f(x+1)`, you first do `x+1` and then take `f(_)` of that.

Re: Why do we use R rather than Excel?

#263

Earlier quoted context omitted.

For those who haven't used it, ctrl-r in the command line is the best thing in the world. It does a reverse-search over previous commands. Set your max history size to unlimited, and your CLI will remember /all/ commands you ever type, making it very easy to find long, strange incantations that you figured out once, so long as you can remember some small part of the command. For example, How did I do that magical ffm…

Does this work on Mac OS? I’ve got a bunch of saved notes with various incantations that would become redundant if so!

> I’ve got a bunch of saved notes with various incantations that would become redundant if so!

Throw them in scripts! Another advantage of using a CLI is that it provides a friction-free path from ad hoc commands to saved commands to messy scripts to properly supported tools. I've ridden this gradient multiple times prfoesssionaly, especially now that I work with a bunch of PhDs who are less comfortable around OSes than I am. It's a good feeling to have such a clean pipeline from "this command/series of commands feels awkward to me" to a reviewed, checked-in tool that becomes a critical part of the team's workflow. The best part is that there's value at every incremental step, so you don't need to invest any organizational effort, which is especially useful in a chaotic execution environment.

Re: Why do we use R rather than Excel?

#264
post #96

Earlier quoted context omitted.

> it really is a superpower in many contexts. It's a trap because once you get comfortable in Excel you have a lot of resistance to try anything more productive than Excel. Seen that numerous times with people who work really fast with Excel yet end up very limited as to what they can actually deal with beyond simple problems.

Disagree. Wanting to automate and learning functions within functions pushed me to learn how to program in python and R

I was about to comment the same thing. Learning how the logic in excel worked was a fantastic first step into learning programming (python specifically).

Re: Why do we use R rather than Excel?

#266
post #120
post #81

Earlier quoted context omitted.

Almost all of these are issues with floating point in general, I'd say. Some are with naive implementations of Excel functions, fair enough (for example variance as (sum x_i^2/n - (sum x_i/n)^2) that are indeed better implemented in R or Julia. IEEE 754 just has unintuitive properties. Kahan (the "father of IEEE 754") has a rant (among many others) about Excel as well, and how it tries to hide some of the floating po…

But you also have issues like 'Catastrophic cancellation': https://carolomeetsbarolo.wordpress.com/2012/07/20/catastrop... Or: "OOPS XL Did It Again" https://carolomeetsbarolo.wordpress.com/2014/06/22/oops-xl-d... From the Wikipedia article: "Although Excel can display 30 decimal places, its precision for a specified number is confined to 15 significant figures, and calculations may have an accuracy that is even less…

That's an issue inherent in floating point computations with fixed precision (such as IEEE 754).

  julia> 1e20 + 1000 - 1e20
  0.0

  julia> 1e20 + 10000 - 1e20
  16384.0

  Python 3.9.6 (default, Jun 28 2021, 19:24:41) 
  >>> 1e20 + 1000 - 1e20
  0.0
  >>> 1e20 + 10000 - 1e20
  16384.0
Post reply on HN