Skip to content
HomeVideosBooks
AllTopicsTrends
BlogsPodcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    R InfernoPatrick Burns

    R Inferno

    Patrick Burns · 2012

    Other
    Open LibraryAmazon
    Stats for nerds
    2recommend
    4mentions
    4people
    2011–2014years
    50% recommend50% neutral

    Mentions per year

    2011201220132014

    What Hacker News says

    1. PermitApr 2014
      I was surprised at the difficulties I had using R at my previous job. It's simultaneously a language I enjoyed, and one I'd feel hesitant to recommend a friend because of the flood of complaints I'd have directed at me as they learned it.

      I love the concept of vectorized operations, but God almighty did I struggle with the differences between indexing a list with list[1] vs list[[1]]. Other hangups included the differences between lapply, sapply, apply or the difficulty with which one has applying operations to the rows of a dataframe. Other frustrations like naming conventions are apparently results of legacy code.

      I'd strongly recommend the book The R Inferno[1] by Patrick Burns. It eases you through the nine circles of R hell that most newcomers seem to endure.

      thread
    2. ltjohnsonFeb 2011
      No, but I can give some suggestions. It would help to know what you want to do.

      First of all, you need to decide if you want a language reference, or an application guide, as R books fall into those two categories.

      If you have a specific type of work in mind (bio-informatics, data mining, data visualization, ...) I'd say to find a book that focuses on that topic. I haven't looked in a while, but I haven't seen a general R book that I like, anything I suggest there would be guessing on my part.

      There are plenty of good references on the web. I'd start by looking at the material available from the R web site:

      R's core manuals [1] are typically correct and reasonable to use. The "Introduction to R" guide will get you up to speed fairly well if you already know another programming language. There is also the contributed documentation [2]. I haven't gone through these, so I can't say much about them, or promise that they are up-to-date. I suspect not, as R develops rapidly. The one reference I can recommend highly is "The R Inferno" by Patrick Burns [3]. This is not a starter guide, but something you read after one. It gives excellent advice on avoiding common pitfalls in R.

      [1] http://cran.r-project.org/manuals.html

      [2] http://cran.r-project.org/other-docs.html

      [3] http://www.burns-stat.com/pages/Tutor/R_inferno.pdf

      thread
    3. rainforestJan 2014
      Patrick Burns' R inferno[1] enumerates a lot of R's eccentricities and workarounds for them. I think R gets a lot better once you switch to using the libraries Hadley maintains like plyr and ggplot. I still think proficiency in R is akin to a type of Stockholm syndrome.

      [1] : http://www.burns-stat.com/pages/Tutor/R_inferno.pdf [PDF]

      thread
    4. crowdingDec 2012
      I've used Matlab for about 15 years and R for about 3. Matlab burned me pretty badly during my graduate career; two weeks after deciding to learn R, I'd recreated a data analysis/modeling/graphing problem I'd previously done in MATLAB, using about one third the amount of code in R. Perhaps R and its available libraries better suit the way I think about problems, but most people in my department agree I code circles around them in Matlab, and I've since repeated the experiment with similar results.

      So, some reasons a Matlab user might want to consider learning R:

      -- R is currently the lingua franca for academic statisticians. New methods papers, textbooks, and toolkits are much more likely to ship with R libraries and implementations then Matlab or anything else.

      -- Speaking of statistics, the MathWorks' most recent revamping of the Statistics Toolbox is an obvious imitation and pale shadow of base R, giving you a more verbose way to do half of what base R does for statistics, and then R has everthing available on CRAN to add to that.

      -- R is a smaller, yet more expressive language. To be fair, it has about the same density of WTF and non-orthogonality as Matlab (which see, Patrick Burns' "The R Inferno") but makes up for it by being much better at functional programming, and by having more of the Lisp nature in general (R is homoiconic; you can write R code that manipulates R code). If you want object-oriented programming you're about equally screwed in both languages though. R has syntactic support for named/optional arguments to functions, as opposed to Matlab's horrible InputParser/nargin hacks.

      -- and in general the idea of giving names to things (rows and columns of a matrix, individual elements, function arguments) is pervasively supported in R. Matlab doesn't even have a decent approximation of a hashtable.

      -- R is not quite as insistent on being its own universe. For example, you can write R scripts invokable directly from the shell, without jumping through awful "expect" style hoops and waiting 30 seconds for system startup / license server failure every invocation. For reproducible analysis you really want a build tool ( http://archive.nodalpoint.org/2007/03/18/a_pipeline_is_a_mak... ); so having your analysis scripts being callable by Make or SCons is a no-brainer.

      -- Speaking of reproducibility, much of the "reproducible research" movement (which basically says, "hey, maybe scientific data analyses and papers should be done with version control, build automation, and maybe even testing, like software people have been doing since forever") is centered around R. I'm currently doing a project with "knitr," an R library that helps writing reproducible reports; if I want to talk about a particular graph or cite a p-value, I don't manually copypasta the data into a word processor; I write in my document the command to compute the value or plot the graph, and it gets updated whenever I render to a PDF. That ensures that results keep track of any changes in dataset or analysis.

      -- The R community in general is more frank about its shortcomings and limitations, which might only be possible in a free software project. For both systems, you can say, word for word, that "there are a lot of awful decisions that (R/MATLAB) inherited due to (S/MATLAB)'s 1970s origins in (John Chambers/Cleve Moler)'s attempt to build a useful sort of interactive shell over Fortran numerics libraries, which it turns out should not be what you build a real programming language on top of." The difference is that the R folks will talk openly about the ways in which R sucks, but you won't get any such acknowledgement from the Mathworks.

      -- R-help is both more active and contains smarter inhabitants than comp.soft-sys.matlab. Similarly for R/Matlab questions on StackOverflow.

      -- R has a much better packaging system. Actually I should change the emphasis: R even has a packaging system. Libraries install from CRAN/Bioconductor/Rforce with one command, and installing them doesn't tromp all over the global namespace. The code is much higher quality than you find on the Mathworks File Exchange; most of the time I look on the File Exchange anything that looks like it solves my immediate problem hasn't been updated for 5 years and no longer works. CRAN on the other hand has maintainers who will remove packages that stop working. Consequently, people take more ownership of their packages.

      -- ggplot2 is the best library in any language for taking your data and making a useful 2d plot out of it. I've written hundreds of lines of Matlab to build graphics that are a couple of phrases in ggplot. On the other hand, Matlab is better at 3d graphing (which I hardly use) and interactive graphics (but there's a lot of people attacking that on the R side.)

      -- Simlarly I've written hundreds of lines of Matlab to do data manipulation operations that are like breathing air with Hadley's other great library, plyr.

      -- Downsides? R is somewhat slower (if you want to compare two laughably slow languages; we're talking roughly CPython vs Ruby). Matlab has a better IDE with better debugging facilities. Depending on your field you might have more colleagues that are familiar with Matlab (true for engineering, definitely false for statistics.) R's online help is harder to navigate, which lends it a somewhat more difficult learning curve. Actually creating a package to distribute your code is pretty hard to figure out.

      thread

    Related

    Cover of Inferno
    2016–2025

    Inferno

    Dan Brown
    0 recommend · 7
    Cover of Burn
    2021–2026

    Burn

    Herman Pontzer
    12 recommend · 22
    Cover of Pale Fire
    2008–2026

    Pale Fire

    Vladimir Nabokov
    41 recommend · 101
    Cover of Burning Chrome
    2008–2026

    Burning Chrome

    William Gibson
    25 recommend · 72
    Cover of Kill It with Fire
    2021–2026

    Kill It with Fire

    Marianne Bellotti
    10 recommend · 16
    Cover of Marx's Inferno
    2017–2018

    Marx's Inferno

    William Clare Roberts
    2 recommend · 7
    Cover of Divine comedy
    2011–2026

    Divine comedy

    Dante.
    16 recommend · 74
    Cover of We were burning
    2010–2025

    We were burning

    Bob Johnstone
    2 recommend · 9