10 ms·
The popularity of R amazes me. I took a one-week class in R and left with a vow to avoid it at all costs. I have never seen a more confusing, hard to understand
by throwawayboise 5y ago
The popularity of R amazes me. I took a one-week class in R and left with a vow to avoid it at all costs. I have never seen a more confusing, hard to understand, inconsistent software product in my 30 years as an IT professional. It's apparently targeted at scientists and sociologists who are non-programmers. I have no idea how they manage to use it.
- blacktriangle 5y agoMy description of R: It makes hard things easy and easy things hard. Ergonomically it is the absolute worst "programming language" I've touched in my life. However somehow it managed to become the official language of statistics research and has packages to do any type of analysis you can dream of. I think the reason you and I dislike R is because we just work differently than non-programmers. Non programmers think in purely imperative, straight-forward semantics. They write one-off unmaintainable code tying together libraries that solves their immediate problem. Programmers try and write R code as if it was a proper programming language and immediately run into walls. Non-programmers never see the walls because they don't even know there's another way.
- dragontamer 5y agoR > Matlab. But both suck as programming languages. But that's because neither R nor Matlab are primarily programming languages. They're primarily mathematical exploration tools.
- osalberger 5y agoRight. Julia is looking fairly promising as a "real" programming language that is still an excellent Matlab replacement, and possibly to a lesser extent an R replacement, and it does show that there is nothing about filling the exploratory math programming niche that requires it to have the warts that the incumbents have. Fundamentally, R and Matlab are probably best comparable to Perl in terms of how they got popular. While they are rather ugly, they were the first to provide a simple solution to a few specific problems that a lot of people had, which snowballed them into popularity and network effect advantages
- mushufasa 5y agoThe fact that Julia requires compilation seems like such a huge hurdle to adoption in light of the above. When the alternatives are a REPL and the users aren't programmers, to use Julia they have to first learn the difference between code and compiled code.
- beforeolives 5y agoJulia is JIT compiled and most people use it through a REPL. For a beginner there's hardly a difference in the experience.
- dash2 5y agoNo, there is a difference. My day-to-day use case is: start the REPL, start typing some code, wanna see a graph. I might literally only want to write a single command. If that takes a minute to compile, it's a problem. Julia is pushing hard to address this and I'm really interested to see where it goes - I tried it for the first time recently and saw a lot to like.
- adolph 5y agoProject Jupyter's name is a reference to the three core programming languages supported by Jupyter, which are Julia, Python and R https://en.wikipedia.org/wiki/Project_Jupyter https://en.wikipedia.org/wiki/Project_Jupyter
- edgyquant 5y agoJulia isn’t compiled tho it has a REPL?
- TeMPOraL 5y agoOne isn't precluding the other. For example, SBCL is an implementation of Common Lisp that compiles everything ahead-of-time down to native code, and like all Common Lisp implementations, it offers a powerful REPL suited for interactive development. The compiler has low overhead, so you don't even notice that it compiles everything you type into your REPL. Another common misconception is that AOT compilers can only be used to build libraries/executables, which then get executed. Again, SBCL is an example of an AOT compiler that works at function-level granularity[0], in accordance with Lisp heritage of image-based development, where you write your program by starting it, and then adding/removing/modifying code into a running instance. SBCL achieves this by having the compiler being a part of your application runtime. I don't know how Julia is implemented internally, but since it's essentially a Lisp clothed in syntax that's more pleasant to the masses, it inherits a lot of Lisp family heritage. That could easily include a fast, to-native, in-process AOT compiler. -- [0] - Or maybe even lower.
- kuang_eleven 5y agoLuckily, Python >> R > Matlab, and the fight between R and Python is core to data science. Last I did any real investigation, R still had the edge in highly-theoretical and new techniques, for whatever reason it was much more used by academics, but Python was eating R's lunch for non-academic data science.
- dragontamer 5y agoI've given SciPy a try, but its performance is grossly lower than R and Matlab in my experience. SciPy also seems to be missing plenty of things. You get pretty far (basic filter design seems easier in SciPy than Matlab), but Matlab has so many different mathematical fields in it that Matlab vs Python are just incomparable in terms of mathematical usability. Matlab has way more features. R is statistical-slant, so you have all sorts of distributions and statistical features. Matlab is general mathematics (but especially matricies). So you can grab say... Galois Fields between 2^2 through 2^16 and just start working with them immediately. Matlab itself is decently replicated by Octave (which is a great project), but it should be noted that Octave aims to be largely compatible with Matlab (so all of my complaints about how awful that programming language still applies).
- bachmeier 5y ago> somehow it managed to become the official language of statistics research There's zero mystery to this. The intended audience is people that want to get stuff done. Professional software developers commenting on R are like this: "He's such a good salesman. He does everything the right way. He dresses right. He talks right. He has the best smile of any salesman I've ever seen. He fills out his reports on time. Granted, he doesn't make many sales, but why would you hire one of those other guys over someone that's perfect?"
- Grimm1 5y agoMmmm more like like they try to put the salesman in an operations role and wonder why the company has broken down. If you tried to use R for an actual engineering project you'd wind up with a system that is always on fire. Where as these one off analysis it's fine because it's just a one off. We want to get stuff done too, but we need it to hold up for more than a few hours so that's the mode we think in.
- bachmeier 5y agoEvery HN discussion: I do real programming. Everyone else works on toy problems.
- Grimm1 5y agoIt's all real programming and it has all the real consequences, but there is a distinction between something that needs to live for a day, a few months, maybe years and then maybe have multiple people work on it, have it communicate with other systems or not and the level of investment and structure you need to put into a system to make sure that's possible. Programming has a very low barrier to entry and that is incredibly powerful but there is a big gap between someone writing one off scripts to solve immediate problems and people writing highly connected systems that withstand scrutiny. I've always personally been for accreditation for software engineers much like pretty much every other engineering discipline.
- blacktriangle 5y ago
- andyonthewings 5y ago> It makes hard things easy and easy things hard. People also say it for k8s. And it kind of explains why k8s is creating so many jobs.
- ghaff 5y agoI'd generally argue that, if you're trying to do easy things with Kubernetes, there's a good chance you're using the wrong tool.
- outworlder 5y ago> And it kind of explains why k8s is creating so many jobs. Is it 'creating' jobs? I think it's merely making it easier to specialize. A few problems are unique because of container usage, but by and large K8s is trying to do what's otherwise a difficult job. Try assembling your own distributed container system with scheduling and whatnot and see if you can build something easier to understand or that works better. Maybe you can, but there's inherent complexity. The criticism of K8s should really be criticism of indiscriminate container usage and the attempts to ship a company's organization chart as microservices. Many applications should really be monoliths and would work better that way. Some should be split on different "services" (not _micro_) along obvious interface points. Just a minority should be architected as microservices from the get go. Distributed systems are _hard_
- collyw 5y agoI imagine that you could get rid of kubernetes in 90% of the projects it is used in. We have it at my work, must have taken around six months to a year for on dev. Sure we can autoscale now, but we never actually need to. It saves us a bit in server costs, but more in maintenance / dev time.
- jokethrowaway 5y agoWhat's the previous system you had which required less maintenance than k8s?
- sedeki 5y agoFWIW, R started to make sense to me (as a programmer) once I read Advanced R by Wickham.
- mbreese 5y agoI have a colleague that use R as a general purpose language (I'm in science), and it's horrible. He runs into problems all the time and usually the answer is "more RAM". For the things it's good at, it's great. For everything else I avoid it like the plague. More often I find it easier to use a quick Python script to generate a data table that I can then read into R to perform whatever stats or plots I need. It's almost always faster than if I had just run everything in R to begin with. But I think your description is spot-on. Non programmers just want to get something done and if it works in R, then great. For those of us that think in terms of software engineering, good practices can be difficult in R. The vanilla-R vs Tidyverse split has made this all worse too. These are two completely separate dialects of R that while still the same language, are completely different. It's like the R folks took the "there's more than one way to do it" mentality from perl and said "challenge accepted!".
- A4ET8a8uTh0 5y agoI agree overall. In my particular case, my employer won't let me have Python for fear I will do things with it. But it is perfectly ok for me to RStudio with 2 million useful extensions that will do similar things. For better or worse, sometimes the tools we use are the tools we are left with. And I am saying this as a recent RStudio convert. I love how easy it makes some otherwise hard things. I hate the sheer amount of hoops you have to jump through to make some stuff work. But it works and I am definitely not an engineer.
- crispyambulance 5y agoJust like any other programming language, it DOES take a good programmer to make a decent library in R that people can use on their own problems. R has had a very long evolution. It is a very different beast today in its most common usage, than it was the earlier days 10, 20+ years ago. Even the Tidyverse has some libraries that are very much crafted with a programmer mindset like purrr and tidyr. These tools are decidedly non-imperative and not straight-forward in their semantics. What makes R difficult for experienced programmers, I think, is the inconsistency of paradigms that are the result of its long history. This complicates how one writes library code. There is, however, a "sweet-spot" for R and that would be as a "notebook" based programming language much like Mathematica, Matlab, and Julia. Which one you like, I guess, depends on your taste, your own history, and the killer libraries you want to use. Whenever I have to describe what R is all about to excel jockeys at work, I just say it's "excel on sterioids". I think that's fair (albeit reductive) description. To be honest, I probably would have never learned R if Julia had existed when I started picking up R. I think I would have preferred a more ahistorical language with less "baggage" than R. But it's always worked out for me, so I am sticking to it at least for now.
- haihaibye 5y ago> R: It makes hard things easy and easy things hard Maybe you'd like this post: http://bioinfomofo.blogspot.com/2014/01/r-hard-things-are-easy-and-easy-things.html http://bioinfomofo.blogspot.com/2014/01/r-hard-things-are-ea...
- CapmCrackaWaka 5y agoI was a mathematics major in college, and didn't have much training in programming when I graduated. R was the first language I learned when I started my career as an actuary, and it was a breeze. Things “just work”. Want to add 2 vectors of different dimensions together? R knows what you’re getting at, and makes it work. Comparatively, learning Python was harder. Now that I’m used to both languages, I find it funny how much R is hated by “true” programmers.
- vharuck 5y agoThis is the key. R shouldn't be seen as a general programming language, but a domain specific language that's still open-ended. I started with SAS in my job, which was fine for statistics and handling tables. But anything beyond that, even supposedly simple things like reusing code or listing all files in a folder, was not simple. With R, it was. R only had to be ergonomically better than the competition, and they weren't very good.
- blt 5y agoWhat are you "getting at" by adding two vectors of different dimensions? It's not obvious to me. Off-by-one dimensionality errors are so common in programming. If the language does something like zero-extending instead of raising an error, it will lead to an "it runs but gives the wrong answer" bug. These are much more painful in numerical code than in logic-based code.
- CapmCrackaWaka 5y agoFor instance, if you wanted to add 1 to every other element in the vector (1,2,3,4,5,6). To someone who has no programming experience, this may be a daunting task. But simply doing (1,0) + (1,2,3,4,5,6) works in R.
- Closi 5y agoThe only problem with this is that I don't personally find it obvious/intuitive that (1,0) + (1,2,3,4,5,6) = (2,2,4,4,6,6). In fact, I would probably expect the output to be (1,0,1,2,3,4,5,6).
- colechristensen 5y agoScientific programming is just different. Much of the culture of scientific programming is different and with good reasons not easy to understand. Its something like how baking cookies at home and running a cookie factory are very different. To a person doing each, the behaviors and priorities of the other seem strange and it’s easy to for one to think “we are both just making cookies, why don’t they do what i do which is obviously superior “ Scientific programmers are solving problems first, not writing programs. They are solving problems in a way that is useful only to them or peers who know a whole lot about the problem being solved. The problem-first tools look strange because they deemphasize the programming niceness in favor of problem niceness. You find the same sort of confusion when programmers are facing business types and excel usage. There are certainly times when a piece of code starts needing the programming touch, but the right tool for the job depends on the job.
- lwhi 5y agoThere's no good reason for something being difficult to understand. Especially a product that's been designed to be general purpose. You give good reasons for why a certain situation exists in scientific communities, but I see no reason why it has to be that way.
- tacostakohashi 5y agoBeing "difficult to understand" is a perspective of an individual observer, not some fundamental property of the thing itself. Japanese is "difficult to understand" if you only know English, but not if you grew up speaking Japanese. The various conventions around "accepted" programming paradigms like OO, inheritance, scoping, etc are natural if you use them every day for years, but if you're more interested in optimizing some finances or solving a physics problem, something "primitive" or "messy" like a spreadsheet formula or fortran might actually be more understandable.
- xeromal 5y agoLove this point
- beforeolives 5y agoI've written some R both for small interactive scripts and running in production, it wasn't the first language I learned - R gets some things done very well; it also has some idiosyncracies, there is stuff that is clearly patched up together and exists for backwards compatibility, and there are many ways to do the same thing in R. If you don't expect it to be perfect, it gets the job done - nothing to write home about and certainly not a language that you should avoid at all costs.
- sharadov 5y agoIt does it well, if there is a package out there for what you are trying to accomplish and hope that the package works for your use case..
- Communitivity 5y agoR programming is fundamentally different at a conceptual level. You are operating on datasets rather than individual values. Also the GUI mechanism use reactive programming if you are using R Shiny. R is awesome for what it is designed for.
- jayd16 5y agoYeah, its not so hard to groc. Its just a data driven style all the way down. You get pros and cons. Its great at working on data sets. That said, I feel like correctness should be given a higher priority in scientific computing and yet a dynamically typed, lazily evaluated language is used.
- agumonkey 5y agoit seems to me that the value is in hard-compressed optimized functions and to this crowd this is the most important factor software engineering practices don't exist unless you have a gigantic program, programming language theory is either not interesting or too foreign for them about how they manage.. it's easy, they get used to it
- froh 5y agoR got a simplicity boost with the "tidyverse", R studio and ggplot, all driven by Hadley Wickham. at its core, R is a very straightforward language. however it never had a benevolent dictator who gave it consistency, elegance and style. Hadley is compensating that a bit.
- asdff 5y agoI'd argue that tidyverse is entirely nonconsistent with the rest of R, though. At least base R packages all operate in an "R-way," so learning this syntax helps you with other packages that others try to write in an "R-way," while tidyverse only operates in a tidyverse way that you can't take your syntax knowledge with you to other packages. I'd say the learning curve for making a sexy plot is a lot shorter with tidyverse, but overall, relying on it handicaps you versus spending the half hour longer to do the same thing with base graphics (or a base-like package).
- roenxi 5y ago> I'd argue that tidyverse is entirely nonconsistent with the rest of R Well, yes, but that is part of the reason why it is so popular. R may be written by world-leading language design experts - but it doesn't show! > ...relying on it handicaps you versus spending... There is almost no reason to drop out of tidyverse if the problem domain is visualising data. Most people could go an entire career as an analyst using just ggplot + tidyverse. If something needs to be plotted and ggplot won't work it probably makes sense to drop out of R and go straight to TikZ or OpenGL.
- asdff 5y agoI think these tools hurt beginners a lot, personally. You have to learn R no matter what you use to plot, but if you want to use tidyverse you have to now learn that too, and the logic you learn there might not transfer over to the rest of R that you are gonna have to learn no matter what, and can lead to confusion. It doesn't help that stackoverflow uses R or tidyverse code interchangably and its up to the beginner to spend time figuring out what is what. I think it even adds to the notion I see, even here on HN in this thread, that R is some awkward unlearnable monstrous thing that has no place. It is that, when you start adding all these different packages and syntax conventions without thinking if your solution can be implemented trivially with base R. I find base R pretty similar to python with small caveats like you don't use loops and you apply functions instead.
- samuel 5y agoThat's are my thoughts, mostly, but in the end libraries are the killer feature of successful programming languages. I have got used to it and I'm more proficient now at data analysis tasks using R than Python/pandas thanks to tidyverse+ggplot. The object system mess though... I have no words.
- breck 5y agoHave you spent time with the community? The community is fantastic. Also, the cheat sheets put out by the RStudio team are the best programming language cheat sheets I've seen for any language: https://www.rstudio.com/resources/cheatsheets/ https://www.rstudio.com/resources/cheatsheets/ I don't do R much anymore (at the end of the day I personally have the freedom to start fresh so I choose that over dealing with technical debt in the R language itself), but the R Studio product, team, and R community I found fantastic.
- rossdavidh 5y agoI am primarily a python programmer, but I sometimes use R. You are either going to use a programming language (or library, etc.) made by a programmer pretending they know about statistics, or a statistician pretending they know about programming. Oftentimes, as a programmer, the right choice is the former, but not uncommonly (because statistics is even less intuitive than programming), you really really need to know that the statistics have been done right. If someone has ported the relevant code from R to python, great. If not, bit the bullet and use R, it's where the statisticians hang out. You know, I bet statisticians don't think any more kindly of how programmers make stuff. Our use of the '=' sign, for example. We're just used to that kind of thing, so it doesn't look like a problem to us.
- failwhaleshark 5y agoR was the supposedly the "FOSS" replacement for SAS, and Matlab to a degree. I had to support it and bioconductor. Now, most people just use Python.
- bigbillheck 5y agoWhy the scare "quotes"?
- asdff 5y agoOther than using apply functions instead of loops, coding R is a lot like coding python only you get a lot more of the data science python package functionality already baked into base R. The syntax differences are slight enough where it's pretty easy to move between the two (or find relevant stackoverflow answers instantly to common annoyances). R generally inputs your data and outputs your statistical test results in less code with less headscratching than doing the same in python in my experience. I prefer plotting in R as well.
- jokethrowaway 5y agoMachine learning is ripe with similar examples (tensorflow in primis).
- gravypod 5y agoIt's selling point is it's not matlab. It's downfall is it's not python. The python scientific compute libraries have they're problems but people are using them and math people "get them". I think they have an awful design/api from a programming perspective but most people don't care. Matlab is similarly a strange language but all of it's libraries/tools make what scientists do easy. "Click a button and your code can now run on a compute cluster". R is very popular with stats people but new PhD candidates are beginning to write python implementations of R things (sort of how like DataFrames/pandas happened).
- Fomite 5y ago"R is very popular with stats people but new PhD candidates are beginning to write python implementations of R things (sort of how like DataFrames/pandas happened)." People have been saying this since I was an undergraduate. I'm submitting my tenure packet this year.
- gravypod 5y ago> People have been saying this since I was an undergraduate. > I'm submitting my tenure packet this year. That doesn't mean it isn't happening. If anything, the fact that the rate of adoption is slow over a long period of time would tell me that there's more stating power here. If suddenly 20% used python that would be a warning sign. If there was .5% year over year for decades.... That's different.
- Fomite 5y agoI'm just saying I have spent my entire career in "The year Python unseats R." and also "The year R unseats Python."
- haihaibye 5y ago> R dropped from 8th place in January 2018 to become the 20th most popular language... At its peak in January 2018, R had a popularity rating of about 2.6%. But today it’s down to 0.8%, according to the TIOBE index. https://www.datanami.com/2019/08/15/is-python-strangling-r-to-death/ https://www.datanami.com/2019/08/15/is-python-strangling-r-t...
- ineedasername 5y agoThey can use it because they don't come with preconceived notions of how programming normally works. And it let's them do powerful analysis without much boilerplate code along with a library of packages for an enormous range of analytical methods and visualization, all without having to do much in the way if boilerplate coding. Sure the syntax is going to seem alien to them, but so would any first encounter with a programming language. The use case for R simply isn't a traditional programmer. That isn't the target user. Sure if you need an application that might need significant scale you're not going to use R Shiny, but a lot of R work are one-off bespoke analysis projects. Models that do need to be deployed for use at scale in an application take their output parameters from R models and simply implement them in the app. I do this myself, taking coefficients etc, implement a function call in a database and then use the results on the front end.
- Fomite 5y agoThere's a difference, in my mind, between "Programmers" and "Invokers of Code". R is a terrible programming language. It's not a bad language for invoking code, because for many of those people, they're not taught the concepts behind any language, so it's all semi-arbitrary symbols. model <- lm(outcome ~ variable1 + variable2 + variable3, data=data) summary(model) Isn't any more complex than anything else. And what R does have is a network effect - at this point, for almost any statistical task I've ever encountered, there's R code for it.
- tarsinge 5y agoI'm a professional programmer and I don't find R hard to understand. Have a look at R for Data Science[0], maybe you'll see why scientists and statisticians find it easy for their analysis and visualizations (and conversely find Pandas+Python very complex). [0] https://r4ds.had.co.nz https://r4ds.had.co.nz