Hacker News new | ask | show | jobs
by neya 3115 days ago
I'll probably get downvoted for this, but let me tell you - Please don't use R in production. Please don't use R for any serious work.

Over the years, I've come to learn to appreciate the fact that languages are just tools. You simply use the right tool for the job. If you let your personal bias, love/hate get in the way, it will cause you a lot of pain in the long run. In the same token, R is one of the most fucked up languages to work with if you use it simply because you assume it's good for all analytics-related projects. It's not.

In one of my previous companies, we had a hipster, always used everything that's on trend. Against all advice, he decided to use R for many of our internal and client facing projects.

For what would have taken a week if Rails were used, he'd write everything in R Shiny. Yes, he used a statistical programming language to write a web application and serve APIs(!). Performance was terrible. There were lot of break downs. Development prolonged, even his own team members lost morale. I unfortunately had the ill luck of having to maintain some of his codebases and those days were the worst in my life. Worse yet, he didn't have a formal software engineering background, so he loved the idea that you are able to code everything inside of this blackbox called R Studio. Fuck tests, there were no tests written because he didn't understand the importance of tests. The projects he worked on lasted for nearly 1.5 years without completion. Almost every project had an instance on the cloud running an R server and it also costed a LOT simply because it was eating a lot of memory. Even our Ruby projects didn't consume as much.

Eventually most of the projects failed, we lost lot of customers. Many team members quit. All because of one singular mistake of choosing a language that's not right for the job. Eventually, one of our competitors came up with a working prototype in production using Python, Flask and with much better analytic capability at scale in less than 3 months. Python can do a LOT that R can do and cannot do and the code is much, much easier to read.

For example, string concatination:

Python:

    hello + world
R:

   paste("hello","world",sep="")
If you're really interested in data science and/or analytics, I sincerely urge you to start with Python and Pandas together rather than R. It is much, much performant, easier to reason, and much, much easier to maintain and scale. Please consider this as heartfelt advice based on my mistakes rather than a rant. Thank you.
1 comments

But if you know R, you can change the behavior of operators.

    > oldPlus <- `+`
    > `+` <- function(e1, e2) {
    +     if (is.character(e1) && is.character(e2))
    +       paste(e1,e2,sep="")
    +     else
    +       oldPlus(e1,e2)
    + }
    > "hello" + "world"
    [1] "helloworld"