Slashdot Mirror


R Throwdown Challenge

theodp (442580) writes "'R beats Python!' screams the headline at Prof. Norm Matloff's Mad (Data) Scientist blog. 'R beats Julia! Anyone else wanna challenge R?' Not that he has anything against Python, Matloff adds, but he just doesn't believe that Python or Julia will become 'the new R' anytime soon, or ever. Why? 'R is written by statisticians, for statisticians,' explains Matloff. 'It matters. An Argentinian chef, say, who wants to make Japanese sushi may get all the ingredients right, but likely it just won't work out quite the same. Similarly, a Pythonista could certainly cook up some code for some statistical procedure by reading a statistics book, but it wouldn't be quite same. It would likely be missing some things of interest to the practicing statistician. And R is Statistically Correct.'"

35 of 185 comments (clear)

  1. Can't use it by smittyoneeach · · Score: 5, Funny

    Nothing with a name that verbose can possibly be any good.

    --
    Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    1. Re:Can't use it by rudy_wayne · · Score: 2

      R#

    2. Re:Can't use it by FatdogHaiku · · Score: 3, Funny

      Is this the programming language of Pirates?
      Is this the programming language for Pirates?
      Is this the language for programming Pirates?
      Arrr...

      --
      You have the right to remain sentient. If you give up the right to remain sentient, you will be elected to public office
  2. Hard to believe in these figures by CRCulver · · Score: 5, Funny

    And R is Statistically Correct.

    I don't see any margin of error. This claim is scientifically worthless.

    1. Re:Hard to believe in these figures by I'm+New+Around+Here · · Score: 2

      It dices. It chops. It purees. It makes my food taste better, to a not insignificant amount.

      Any other claims you want to hear from a chef*?

      .
      *Note: Worked in several restaurants during and after high school. Now I occasionally cook or make deserts at home.

      --
      If you think I voted for Trump because of this post, you're wrong. I voted for Dr. Jill Stein of the Green Party. Again.
  3. Bad analogy by Florian+Weimer · · Score: 5, Insightful

    An Argentinian chef is more likely to make great sushi than a Japanese automotive engineer.

    You generally want to use programming languages designed by experienced programmers (even better, experienced language designers) who work closely with subject matter experts. Left to their own devices, experts are likely to get a lot of things wrong, and if the language is sufficiently popular, you are stuck with their mistakes for a long time to come.

    1. Re:Bad analogy by Glock27 · · Score: 5, Interesting

      Exactly. Julia will eat R for lunch soon enough, I think. It's an elegant, well designed and efficient language. It's only been around for a couple of years, and has a very vibrant and rapidly growing community.

      Check it out for yourself: The Julia Language Homepage. It's got a lot to offer anyone with an interest in mathematics, including statisticians. It's based on the LLVM, and interfaces trivially with C libraries - plus it's a very fast language in it's own right, unlike R or Python.

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
    2. Re:Bad analogy by retchdog · · Score: 5, Interesting

      my friend uses julia, and every few weeks complains about some bug. the other day he mentioned that the latest release broke Bernoulli sampling (wtf?). the others have been pretty fundamental too.

      this is a serious problem, of course. the other one is lack of libraries. R is an abysmal pile of shit, but at least it's a standard; pretty much 95%+ of applied stats is at least partially supported by someone's hacked-up library/package. julia is far, far short of that, and it appears that much of its community is more interested in pretty graphics, meta-wankery, and interface methodology than actual working statistics (not that there's anything wrong with that per se).

      yeah, yeah, "fix it yourself," and it's on my list to write at least a basic survival analysis package for it. but i wouldn't blame anyone for not using it, and i wouldn't recommend it for doing stats as it is now.

      --
      "They were pure niggers." – Noam Chomsky
    3. Re:Bad analogy by Gaygirlie · · Score: 3, Funny

      my friend uses julia, and every few weeks complains about some bug.

      He should tell Julia to wear protection and be more careful with who she spends time with so as not to catch so many bugs.

    4. Re:Bad analogy by tomhath · · Score: 2

      Python? Fuhgeddaboutit. Can do, but with a lot more code.

      Yea, with Python it takes up to nine lines of code to calculate the regression and generate a plot

    5. Re:Bad analogy by KingOfBLASH · · Score: 3, Informative

      You're just getting a plot. I'm talking about output that looks like this:


      Call:
      lm(formula = new_day_return ~ prior_day_return + rsi_under_10 +
              rsi_under_20 + rsi_under_30 + rsi_over_70 + rsi_over_80 +
              rsi_over_90 + fourteen_day_rsi, data = mydata5)

      Residuals:
            Min 1Q Median 3Q Max
          -100 -1 0 1 205700

      Coefficients:
                                            Estimate Std. Error t value Pr(>|t|)
      (Intercept) -9.845e+01 3.742e+02 -0.263 0.792
      prior_day_return -4.143e-04 3.434e-03 -0.121 0.904
      rsi_under_10 -1.916e-01 3.798e+00 -0.050 0.960
      rsi_under_20 2.195e-02 1.447e+00 0.015 0.988
      rsi_under_30 -2.291e-01 6.915e-01 -0.331 0.740
      rsi_over_70 -2.364e-01 3.348e-01 -0.706 0.480
      rsi_over_80 5.135e-03 4.820e-01 0.011 0.991
      rsi_over_90 7.162e-03 8.650e-01 0.008 0.993
      fourteen_day_rsi 4.193e-04 3.434e-03 0.122 0.903

      Residual standard error: 163.7 on 1581663 degrees of freedom
          (137 observations deleted due to missingness)
      Multiple R-squared: 5.397e-07, Adjusted R-squared: -4.518e-06
      F-statistic: 0.1067 on 8 and 1581663 DF, p-value: 0.999

    6. Re:Bad analogy by professionalfurryele · · Score: 4, Insightful

      Sorry but I use both R and python in my work as a biomechanist and while I love working with python and hate working in R, R is not only less verbose for this task, but it is more consistent, intuitive and better documented. Very few languages beat python for simple, easy to read code, but it is not up to the task of doing general purpose statistics. To see why this is the case consider a problem with that blog post. All the diagnostic plots I need to do to check the regression are missing, no qq, no cook's, not even something simple like fitted vs. residual. Now consider what happens when I notice that while the fit is decent the residuals depend on what subject I'm looking at and I need to vary the error term. Or need to switch to a mixed effects model because there is clearly a dependence on the intercept by subject.
      Seriously when i say I hate R, I mean it. The code is ugly, it can be hard to read and woe betide the poor git who makes the mistake of needing a plot more complicated that something lattice can do. It is still better than python for statistics.

    7. Re:Bad analogy by I'm+New+Around+Here · · Score: 2

      Yeah? Go back and read it again.

      OK. FW said:

      An Argentinian chef is more likely to make great sushi than a Japanese automotive engineer.

      You generally want to use programming languages designed by experienced programmers (even better, experienced language designers) who work closely with subject matter experts. Left to their own devices, experts are likely to get a lot of things wrong, and if the language is sufficiently popular, you are stuck with their mistakes for a long time to come.

      Upon rereading it, I still don't see an analogy. So let's break it down and verify.

      An Argentinian chef is more likely to make great sushi than a Japanese automotive engineer.

      Not an analogy. A statement of fact, with some supposition. It is possible Japanese auto engineers are all required to be master sushi artists, but unlikely. Still not analogy.

      You generally want to use programming languages designed by experienced programmers

      Again, not an analogy. A statement of personal opinion, which may or may not be factually accurate.

      (even better, experienced language designers)

      More personal opinion. But it certainly makes sense.

      who work closely with subject matter experts.

      Conclusion of personal opinion.
      Still not an analogy.

      Left to their own devices, experts are likely to get a lot of things wrong,

      Again, supposition used to bolster an argument that supports WF's opinion mentioned previously.
      Still not an analogy.

      and if the language is sufficiently popular, you are stuck with their mistakes for a long time to come.

      A final statement of fact. It does assume that mistakes are great enough they can't be fixed in a simple revision, but not so severe that they render the programming language unusable.
      That is still not an analogy.

      But sober this time. Put the cherry schnapps back in mom's liquor cabinet.

      I haven't touched your mother's liquor in several months. Besides, she prefers rum when we do body shots.

      --
      If you think I voted for Trump because of this post, you're wrong. I voted for Dr. Jill Stein of the Green Party. Again.
  4. true, but not really because of R itself by Trepidity · · Score: 5, Insightful

    R itself is okay, but even as a long-time user I don't think the language or environment itself is all that much to brag about. What makes it great for statistics is just that statisticians use it, which means that a lot of the packages are written by statisticians. That makes a big difference: recent papers often have R implementations, standard problems have well-maintained R packages for them with all the bells and whistles, etc. As Matloff notes, this means they often have everything that statisticians are looking for, while straightforward textbook implementations you often find in other languages often aren't nearly as thorough in how they handle the statistical models, or only handle some special cases (though there are some really good packages in other languages, just not as many).

    But I don't think that has much to do with R itself being uniquely suited to statisticians. It's used for historical reasons: Bell Labs S was influential in the field way back when nothing like Python or Julia existed, and statisticians started using it because it was a lot nicer than Fortran, which is what other areas of science mostly used back then. GNU R is essentially a free-software workalike for Bell's S, and it's kept most of the community on board through a mixture of existing packages, familiarity, and inertia.

    1. Re:true, but not really because of R itself by jythie · · Score: 3, Interesting

      *nods* who uses a language has more impact on its usefulness then anything inherent to the language. LIbraries, support community, easy of hiring people who both know the language and have domain specific skills, much more important then what kind of sugar the language has.

    2. Re:true, but not really because of R itself by HuguesT · · Score: 3, Interesting

      R has some pretty unique graphing packages. Nothing that I know of matches the way you can do 2D and 3D plots in R. Not Python, not Gnuplot, not Julia, not Matlab, not Excel, not Mathematica, nothing.

    3. Re:true, but not really because of R itself by Trepidity · · Score: 2

      Around here Python's matplotlib has been making some inroads in the plotting category, even among people who use R for the actual data analysis, but it's admittedly not as featureful as the whole suite of R plotting packages.

  5. Meh by hyfe · · Score: 5, Informative
    Statistics major who programmed Python professionally for a few years (and have a MsC in Comp.Sci) ...

    ... this is all posturing and drama, but good on Prof. Norm Matloff for getting some attention. R is rather usefull, has quite a few extremely usefull features as a language, including some of the best list/indices handling I've seen anywhere. Excellent libraries for statistical work, but it also has quite a few the most downright abhorrent language decision I've seen anywhere ever, with the amazingly poor string handling (for a scripted language) topping that list ( http://www.burns-stat.com/page... )

    Python, C, Mathematica and R all have different strengths for mathematical work / numerical calculations though, and using the best tool for the job is what it's about. As always, what the best tool actually is, is also rather subjective, as which tool will best solve a specific task is always dependent on your skill with the different tools. I do agree with professor though, even though there's quite abit of Python hype (python + scipy/matplotlib is amazing) R is not being replaced anytime soon. It's too good at what it's good at.

    --
    "" How about taking the safety labels off everything, and let the stupidity-problem solve itself? """
  6. A joke on the subject by kav2k · · Score: 4, Funny

    A joke I've read recently:

    I'm not sure if "R is written by statisticians, for statisticians" is a good thing e.g. "stadiums are built by footballers, for footballers"

  7. Who really f-ing cares? by nurb432 · · Score: 3, Insightful

    Use the right tool for the job and stop bashing other tools that were designed for different jobs .

    --
    ---- Booth was a patriot ----
  8. Re:I dislike Python by jythie · · Score: 3, Insightful

    Hrm. I never thought about the whitespace requirements in python from an accessibility perspective.

  9. Re:Data mining by Anonymous Coward · · Score: 2, Interesting

    You got the title wrong.

    _Numerical Recipes in C_, by Press, W. et al

    http://www.amazon.com/Numerical-Recipes-Scientific-Computing-Edition/dp/0521431085

    IIRC there was also a _Numerical Recipes in FORTRAN_ as well.

    Also see http://www.nr.com/ . I think they only have a single book now called _Numerical Recipes_ and it is in its third edition.

  10. Re:I've found the problem... by gnupun · · Score: 2

    "R is written by statisticians, for statisticians"

    Does R invent new syntactic constructs that make it useful for handling/generating statistical data? So far I've not seen any new syntax in R that warrants creating a new programming language -- it's just a rehash of various scripting languages already available.

    From a programmer's perspective, R should just be an easy to use library that you can use in various languages like Python, Julia, Ruby, etc. There's no need to learn new syntax if it's not that new and useful.

  11. Re:I've found the problem... by HuguesT · · Score: 2

    How about the syntax for specifying model?.

    lmfit = lm( change ~ setting + effort )

  12. With R... every day is Talk Like A Pirate Day! by TheRealHocusLocus · · Score: 3, Funny

    "Arrrr.... fix yar name 'R' while you may, maties!!"

    I may not have the belly for Deep Statistics but I do know abut Internet Search noise levels. I remember trying to do research on WebDAV (believe me, there is such a thing) only to discover that folks discussing it invariably refer to it as 'dav'. Because saying "Distributed Authoring [and] Versioning" out loud makes you spit out your toothpick. Any attempt to search 'webdav' yielded only the sterile official pages, and attempts to search on 'dav' with other keywords brought up conversations from the community of Disabled American Veterans who also use the term in casual conversation, and have said an awful lot over the years. They occupied 'dav' first.

    Now you may think you can pull off a 'C' where Google seems to pick off relevant results if you combine it with any computery term, but it was not always so. It has taken an incredible saturation of C, and perhaps some special coded cases on Google's part, for this to come about.

    The success of Perl is due in some part to the ability of confused people to obtain help and advice about it merely by searching on its unique spelling.

    So the best way to push this R language is with a refit of the name. Go with the pirate theme, it will sell many more T-shirts than those of silly camels and pearls. But stake out a bit of Keyword Real Estate that presently has a relatively low population density.

    Google search result estimate counts, descending order,
    r --- 2,730,000,000
    ar --- 656,000,000
    arr --- 24,400,000
    arrrrrrrr --- 3,060,000
    arrrr --- 876,000
    aarr --- 638,000
    arrr --- 536,000
    arrrrr --- 405,000
    aaarrrrr --- 267,000
    arrrrrr --- 205,000
    arrrrrrr --- 129,000
    aarrr --- 107,000
    aarrrr --- 107,000
    aaarrr --- 56,600
    aaarrr --- 56,600
    arrrrrrrrr --- 52,400

    Adding arrrs is not enough since talking like a pirate is typically accomplished with a single 'a', so ar+ space is pretty well populated up to ar{5}, it looks like best ratio is around a{3}r{3}. But even choosing the less-optimum and easier to type a{2}r{3} by using 'aarrr' instead of 'r' you have improved the signal to noise ratio by a factor of twenty-five thousand.

    Push the name change firmly and decisively. This means that if anyone mentions 'R' there should be immediate responses that ask, "What AARRR you talking about?" This will inject the proper searchable term into the discussion while it reminds the poster of the name change.

    For an interesting 9 minute lecture that might help sell you on this idea, listen here.

    --
    <blink>down the rabbit hole</blink>
    1. Re:With R... every day is Talk Like A Pirate Day! by wisnoskij · · Score: 2

      It is scary sometimes how much control the limitations of Google Search has over our lives.

      For example, the best anti pirating system you can use for any game or film is to name it with less than 3 characters. It then becomes very hard to search for it.

      It took me days to find "9" (and I know others who had similar problems), and I think I never did end up seeing "B".

      --
      Troll is not a replacement for I disagree.
  13. If you're going to use R by Johnny+Loves+Linux · · Score: 4, Informative
    Be sure to use RStudio as the front end: http://www.rstudio.com/. Using on R in a terminal is ok, but having the beautiful GUI frontend RStudio makes working with R sooooooo much better! The help system, plots, R markdown (knitr), and inspecting variables in RStudio is so much easier. As far as comparisons go,
    1. R is no competitor to python for writing generic scripts.
    2. Python (numpy, scipy, statsmodels, pandas, sklearn, matplotlib, ipython and ipython notebooks) is not yet ready to compete with R for doing statistical analysis but give Python a couple of more years and then slashdot should do a review of how it compares.
    3. You can always call R from python using the r2py module. This is really easy within an ipython notebook using the %load_ext rmagic command.

    For a nice video on using ipython notebook in data analysis: https://www.youtube.com/watch?...

    For a nice selection of ipython notebooks for doing various type of data analysis: https://github.com/ipython/ipy...

  14. Re:I dislike Python by KingOfBLASH · · Score: 3, Interesting

    Believe it or not, most statisticians are not programming wizards.

    Most stats guys use R, matlab, mathematica, or something similar. Even if it takes days to run a program that would take 20 minutes in C. Sort of like how the business guys will use VBA when they need anything, because that's what they know.

    Languages like R are used because they are accessible. And once they reach a critical mass, everyone learns them in a field.

    Sort of like how Fortran just won't die.

  15. State of Programming in the Sciences by wisnoskij · · Score: 2

    Having seen the state of programming in the Sciences, I really do not thing that "built by statisticians" is something you would want to advertise.

    --
    Troll is not a replacement for I disagree.
  16. Beats python at what? by umafuckit · · Score: 3, Interesting

    A few examples are provided in TFA but it's all rather vague as to why R "beats" Python. I've been using R for years for fitting mixed effects linear models. It does this really well, it makes it easy to compare models, it's got all the cutting-edge stuff in it. The problem with R, however, is that it's shitty and unintuitive as a programming language. I do all my pre-processing in MATLAB and I only ever export to R when I have a final data frame that needs a moderately complicated statistical analysis.

  17. Can't spell warez without R by tepples · · Score: 2

    And to what extent are statisticians willing to use warez?

  18. Re:I've found the problem... by fuzzyfuzzyfungus · · Score: 2

    Don't forget the influence of history: R wasn't designed for superiority to Python, Julia, and Ruby; but in large part to be a GNU-acceptable implementation of S, which may well have been designed for superiority to APL and FORTRAN; and which has existed since somewhere between the-before-time-when-the-gods-were-young and the start of the Second Trilobite War.

  19. DSLs by jbolden · · Score: 3, Insightful

    He's probably right. All other things being equal a good Domain Specific Language will crush a General Purpose Language in its domain. If Julia is much faster than R and that were unfixable it would still be far easier to write a library in Julia accessible by R than to train R users in all of Julia's concepts.

    General purpose languages can sometimes get close to DSLs in effectiveness and then the greater diversity of users creates an economy of sacle and deep entrenchment which drives DSLs away. But then with a large and highly diverse user base the General Purpose language isn't able to rapidly adapt so DSLs spring up to fill niches. Some of those DSLs become incredibly successful and start to move into other domains diversifying their purpose and user base to become General Purpose Languages and the cycle repeats.

  20. true, but not really because of R itself by jonnyj · · Score: 3, Insightful

    Completely right.

    We use R extensively in work. Programmers talk about R's libraries, but that's not the real reason we use it. The killer blow is that the _documentation_ is written by statisticians. That means that it's reliable, easy to understand, and honestly tells you the pitfalls of the techniques you're using.

    We're financial guys who are doing stuff in consumer finance that has rarely, if ever, been done in our field. The statistics aren't particularly advanced, but it's impossible to hire someone who understands the industry and knows the statistics already. Statistics text books tend to either be so basic that you already know what they say, or so advanced that you need a PhD to understand them. On the other hand, much of the R documentation is beautifully simple to read, and comes with brilliant worked examples - albeit from fields that are very different from our own. Whenever we're researching potential new statistical approaches, we find blogs stuffed full of examples written in R.

    In short, the R ecosystem makes you a better statistician. Julia and Python can't offer that.

  21. Flaky by StripedCow · · Score: 2

    From the summary:

    And R is Statistically Correct

    But Python is correct all the time.

    --
    If Pandora's box is destined to be opened, *I* want to be the one to open it.