Live data from Hacker News

Why do we use R rather than Excel?

shkspr.mobi

251–260 of 266 posts

Re: Why do we use R rather than Excel?

#251
post #175
post #41

Earlier quoted context omitted.

I highly recommend anybody getting into R to skip the base language (which indeed is ancient and full of gotchas) and go straight for the Tidyverse[1]. You can always go back in and learn how to do things the old way later. Over the last decade, the R community has largely standardized around tools like dplyr, ggplot, tibble, purrr, and so on that make doing data science work way easier to reason about. Much more erg…

i would recommend getting comfortable with doing stuff with base R, then trying tidyverse. Starting with dplyr might get you results quick, but its "special evaluation" actively confuses your understanding of how the base language actually works (speaking from experience with an R course and subsequently helping other confused folks) Consider this example: # base R starwars[starwars$height % filter( height (Source: h…

Wow, now I understand the reasons. As Python guy I'm having trouble to understand how it is possible in R.

Re: Why do we use R rather than Excel?

#252
post #244
post #71

Earlier quoted context omitted.

I agree that R isn't ideal, and a proper programming language is preferable to both. Which one of course will depend on the domain, but proper control over float precision, fixed-point arithmetics, bignum and debuggability isn't good in R either. It's just that R is still far above Excel.

Why isn't R a proper programming language? What would you use over R for data analysis or statistical analysis? R has a beautiful functional ability based on S-expressions, allowing some clever stuff to be done (i.e. tidyverse), incredibly fast (data.table is faster than Python, Julia, Matlab etc).

Can data.table play well with the tidyverse yet?

And as a side note, I believe it's moving down the rankings in the h2o benchmarks [1].

[1]: https://h2oai.github.io/db-benchmark/

Re: Why do we use R rather than Excel?

#253
post #41

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 real…

I highly recommend anybody getting into R to skip the base language (which indeed is ancient and full of gotchas) and go straight for the Tidyverse[1]. You can always go back in and learn how to do things the old way later. Over the last decade, the R community has largely standardized around tools like dplyr, ggplot, tibble, purrr, and so on that make doing data science work way easier to reason about. Much more erg…

> ggplot

One day I’ll have a whole week free so I can sit down and learn an entire graphical grammar so that I can remove the egregious amounts of chart-junk in the ggplot defaults.

Re: Why do we use R rather than Excel?

#254
post #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…

But why not use the scripting languages built in to Excel?

Re: Why do we use R rather than Excel?

#255
post #196

Earlier quoted context omitted.

the only way to prevent Excel from converting date-like number values into 'real dates' is to format the number values as text. or escape each and every number value so this doesn't occur. this is not just a workaround - it's recommended by Microsoft. because you literally cannot turn this functionality off. how is that not an "Excel issue"?

That is how spreadsheets work. Try Libreoffice or Google Sheets. You will find they operate the same. Spreadsheets format all cells as a generic type where the value entered to it is gets assigned a more specific type by the spreadsheet application. If you want to insure that the value you entered is interpreted as a specific type you need to identify that to the spreadsheet application prior to entering the value.

I was responding to the claim that Excel "doesn't alter data without being asked either." I guess it does, and it should?

Re: Why do we use R rather than Excel?

#256

Earlier quoted context omitted.

> I want to move a thousand files beginning with 'UTR-77' and ending with '.csv' 1. Use a file manager with stable sorting [1] (I use Thunar which does this, but I suspect lots of file managers keep the sort order stable). 2. Sort by type. 3. Sort by name. 4. Select the first file named UTR-77. 5. Scroll to the last file, and Shift+Click it. 6. Cut then paste to your desired directory. [1] - https://en.wikipedia.org/…

This feels pretty squarely in the realm of "but you could still do it manually". The CLI method still seems cleaner and faster, with less likelihood of error since you don't select the files manually.

How is not selecting it manually but implementing code that could select the wrong files any better?

Re: Why do we use R rather than Excel?

#257
post #244

Earlier quoted context omitted.

Why isn't R a proper programming language? What would you use over R for data analysis or statistical analysis? R has a beautiful functional ability based on S-expressions, allowing some clever stuff to be done (i.e. tidyverse), incredibly fast (data.table is faster than Python, Julia, Matlab etc).

Can data.table play well with the tidyverse yet? And as a side note, I believe it's moving down the rankings in the h2o benchmarks [1]. [1]: https://h2oai.github.io/db-benchmark/

Oh that's great. I'm really glad to see Julia getting faster there.

Re: Why do we use R rather than Excel?

#258
post #164

Earlier quoted context omitted.

It’s not full proof, but the heuristic that your stakeholder will ask you for the same thing next week (or immediately ask you to do the same thing but slightly differently) has held pretty true for me

yes, I've got a little heuristic I use to tell the beginner analysts at work when to think about automating their work or putting it into a script. if you're doing something once and once only, maybe it's a candidate for the manual or gui way. if you think you might do it twice, it's almost certainly time to automate or start programming it. Anything encountered in business that you encounter more than 1 time is like…

The good old "allow it never, once or n times" :-)

Re: Why do we use R rather than Excel?

#259
post #175

Earlier quoted context omitted.

i would recommend getting comfortable with doing stuff with base R, then trying tidyverse. Starting with dplyr might get you results quick, but its "special evaluation" actively confuses your understanding of how the base language actually works (speaking from experience with an R course and subsequently helping other confused folks) Consider this example: # base R starwars[starwars$height % filter( height (Source: h…

Wow, now I understand the reasons. As Python guy I'm having trouble to understand how it is possible in R.

https://www.r-bloggers.com/2018/07/about-lazy-evaluation/

tldr: basically, R passes all function arguments as bundles of `(expr_ast, env)` [called "promises"]. normally, they get evaluated upon first use, but you can also access the AST and mess around with it. AFAIK this is called an "Fexpr" in the LISP world.

(originally i had a nice summary, but my phone died mid-writing and i'm not typing all that again, sorry!)

it's very powerful (at the cost of being slow and, i imagine, impossible to optimize). it enables lots of little DSLs everywhere - e.g. lm() from stats, aes() from ggplot2, any dplyr function - which can be both a blessing and a curse.

Re: Why do we use R rather than Excel?

#260

Earlier quoted context omitted.

We never got the results of our covid tests from early in the pandemic because someone imported the medical data into Excel, which predictably and destructively modified the patient IDs by stripping all leading zeroes. I've used perl, python, and R for scientific data for a really long time but have always made a concerted effort to avoid Excel. My reasoning feels the same as when people say Java is the best language…

> My reasoning feels the same as when people say Java is the best language because it can be run on any device, which is like saying anal sex is the best sex because you can do it with any animal. Please tell me you have said this to someone in a work meeting. This is hilarious.

Even if it wasn't used, I may end up using it at work myself.
Post reply on HN