Live data from Hacker News

A newcomer’s (angry) guide to R

arrgh.tim-smith.us

21–30 of 232 posts

Re: A newcomer’s (angry) guide to R

#21
post #2

I think many of the gotchas and annoying parts of base R are solved by using tools from the tidyverse: http://github.com/tidyverse . For example, the pain of needing to specify `stringsAsFactors=FALSE` is solved in the tibble package by setting a sensible default. At any rate, at least it's not Pandas and matplotlib...

I can't stand the non-standard evaluation of the tidyverse. It works great for writing one-off scripts, but as soon as you start trying to put it into functions or your own package it's just not worth the pain of quosures and the tidyeval nonsense that changes every 6 months.

Re: A newcomer’s (angry) guide to R

#22
post #3

> There are subtle differences and some authorities prefer ...I am confused here. If you're testing for equality, R requires you to use == and not =. If you try to test for equality with =, it throws an error instead of treating it as an assignment. That's good. But who is trying to test for equality with <-?

I had the same confusion, can only assume the author is worried about this typo:

    if(a 
(which I assume is a less-than comparison, though I don't know R).

Re: A newcomer’s (angry) guide to R

#23

Having used Python, JSL, Julia, R and Matlab; I agree with most of the things in R. R is an extremely ugly language. It seems to be created by people who wear capris and uggs (both at the same time). But, R has incredible packages, especially the work done by Hadley Wickam. ggplot2 is beautiful. It is utterly gorgeous. It is what Ted Baker is to the capri guys that designed the language itself.

ggplot2 produces beautiful graphs. I don't think it's beautiful as a package -- the syntax is strange and reflects an earlier evolution of the ideas that went into the tidyverse. Notably the use of + instead of chaining operators, the use of a custom "ggproto" object system instead of S3 (which makes extensibility a nightmare), and the superfluous presence of the aes() function (rendered unnecessary by better lazy ev…

[deleted]

Re: A newcomer’s (angry) guide to R

#24
post #11
post #2

I think many of the gotchas and annoying parts of base R are solved by using tools from the tidyverse: http://github.com/tidyverse . For example, the pain of needing to specify `stringsAsFactors=FALSE` is solved in the tibble package by setting a sensible default. At any rate, at least it's not Pandas and matplotlib...

That particular issue can also be solved by setting options(stringsAsFactors = FALSE). Anyway, the default behaviour was the sensible thing to do at the time: https://simplystatistics.org/2015/07/24/stringsasfactors-an-...

Beware of adding that to your .RProfile though. The author makes a good argument for why that's a bad idea: your code will execute differently on someone else's machine.

http://arrgh.tim-smith.us/factors.html#fn:options

Re: A newcomer’s (angry) guide to R

#25
post #19

HN is predisposed to hate R because everyone here is coming from a "real" programming context. Their concerns are generally valid, but they should keep in mind a lot of people using do not have a software development background and do not care that the language is not elegantly designed: they just want to get analytical work done. In that respect, R is far, far superior to Python. Even something as simple as installi…

As a datapoint in agreement. Some of the Biologists I work with love R. I had one tell me that its like how they think, and they weren't a python fan.

I think R-Studio (an R based IDE that turns it kinda into a more excel like experience) where you can inspect the data in memory (including matrix data) and graph making is where it really helps bring people into the R language. And with a set of instructions anyone can go load the analysis packages and do their data analysis.

Compare this to python, where they have to go the unix shell set up the environment, load the libraries. When they come back reset everything and get back to where they started.

Re: A newcomer’s (angry) guide to R

#26

Having used Python, JSL, Julia, R and Matlab; I agree with most of the things in R. R is an extremely ugly language. It seems to be created by people who wear capris and uggs (both at the same time). But, R has incredible packages, especially the work done by Hadley Wickam. ggplot2 is beautiful. It is utterly gorgeous. It is what Ted Baker is to the capri guys that designed the language itself.

My personal hack to deal with the unbearable ugliness of R is to use Rpy2 and call R packages from Python --- at least writing some boilerplate code in Python makes me happier than having to write in R.

Second this. Pandas / Numpy / Numba until I hand off to ggplot, lmer, or whatever specialized R package.

Re: A newcomer’s (angry) guide to R

#27
post #24
post #11

Earlier quoted context omitted.

That particular issue can also be solved by setting options(stringsAsFactors = FALSE). Anyway, the default behaviour was the sensible thing to do at the time: https://simplystatistics.org/2015/07/24/stringsasfactors-an-...

Beware of adding that to your .RProfile though. The author makes a good argument for why that's a bad idea: your code will execute differently on someone else's machine. http://arrgh.tim-smith.us/factors.html#fn:options

That’s true. It may create more problems than it solves. I don’t change the default value myself, setting stringsAsFactors=FALSE when required is good enough for me.

Re: A newcomer’s (angry) guide to R

#28
post #19

HN is predisposed to hate R because everyone here is coming from a "real" programming context. Their concerns are generally valid, but they should keep in mind a lot of people using do not have a software development background and do not care that the language is not elegantly designed: they just want to get analytical work done. In that respect, R is far, far superior to Python. Even something as simple as installi…

Yes a couple of years ago I did this project where I needed to get a ton of analysis done, typically with plots and tables as output. Did this in python and it was this huge mess with pandas and matplotlib. Re-did it in R with data.table and ggplot2 and it was just ridiculously easier, and I could expand upon the code much more easily, plus the output was much prettier.

Re: A newcomer’s (angry) guide to R

#29

As a long-time R user, I agree with all of these complaints. The language itself is ugly and actively tries to get in your way. I'll add that concepts like data frames are not really intrinsic, and you get needless complexities like "length", "nrow", "dim", each of which does the wrong thing in 90% of the scenarios of interest. The confusion of lvalues is another strange quirk -- a If you discipline yourself to learn…

What is needlessly complex about length, nrow, and dim and why would they ever give you the wrong thing? length always gives the length of an object, i.e. the number of elements in it[1]. nrow will always give the number of rows, and dim will always give the dimensions e.g. for a data.frame with 3 rows and 4 columns dim(df) is (3, 4).

[1]That is, top-level elements. If a list L contains 3 vectors, each with 9 elements, length(L) is 3, not 9 or 9*3 = 27

Re: A newcomer’s (angry) guide to R

#30

There are a bunch of odd non-standard syntax choices in this tutorial. For example, the author ends statements with semicolons. R does allow equal sign assignment (although style guides prefer the stupid arrow syntax). The author mentions Bioconductorm the... second biggest package repository for the language? I clicked because I was a programmer for 15 years before I used R, and I have subsequently developed and shi…

the "stupid arrow syntax" is not nearly so stupid, and I speak here as a 10+ year Python developer, as the misuse of the equal sign that every C-style language seems to think is ok. The = sign meant something long before computer programming, and it is something the developer community ought to be ashamed of that it is being used for "change this thing to that". /rant
Post reply on HN