Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Is it true that "R is the easiest language to speak badly"? (r-bloggers.com)
17 points by TalGalili on Feb 1, 2012 | hide | past | favorite | 3 comments


I think there's an interesting parallel to be drawn between natural languages and programming languages:

"Work on sociolinguistic typology suggests that languages/varieties spoken by small, isolated com­munities tend to show a considerably higher degree of structural complexity than languages spoken by larger communities with more language and dialect contact (Nichols 1992, Trudgill 2004)."

http://www.frias.uni-freiburg.de/lang_and_lit/veranstaltunge...

I think the same could be said of R -- having evolved naturally within an (initially) small community of statisticians, there hasn't been the pressure to standardize and simplify that comes with a wider and more diverse user base.


R as a language is highly multi-paradigmatic, while remaining essentially a specialized tool for statistical analysis whose users, often scientists, are not first and foremost programmers. Also, the usefulness of R depends on a huge range of contributed packages, leading to duplication of effort and disparate approaches to the same problems.

Because the language is friendly and intuitive enough on the level of manipulating datasets, and template code is available for all of the popular tests and plot types, you can go very far in R without actually learning to program deeply. Considering all this, it is not surprising that a lot of user code is inelegant, inefficient, etc. Perhaps we should be more tolerant of this, compared to other languages, in light of R's status as a rough 'n ready tool for quick analysis, simulation and prototyping.

Of course, reference and contributed R code should show exemplary style. And R code that is aware of the intricacies of the language - the consequences of lexical scoping with lazy argument evaluation, S3, S4 + Reference classes, environment implementation, the possibilities of 'computing on the language' - can be a thing of beauty. I think it's a wonderful language, and I would like to see many of its features implemented in more general purpose languages for application development.

Often it's just the little things. As a very basic example, I am someone who has always disliked that the assignment operator in so many languages is the mathematical symbol for equality. I'm not entirely happy with prefix syntax for assignments either. While R supports "=" and assign() for assignment, it pleases me no end to use "<-" or "->" (and the corresponding nonlocal "<<-", "->>"), with their implicit directionality and action of a target "getting" a value.


The combination of R as a statistics dsl, a derivative of the S language plus the majority of users who are not writing complicated software applications makes for a lot of diversity in syntax for better or worse.

There are also simple ways to do things i.e. qplot and then the regular way ggplot.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: