Live data from Hacker News

Why Clinical Laboratorians Should Embrace the R Programming Language

aacc.org

41–50 of 62 posts

Re: Why Clinical Laboratorians Should Embrace the R Programming Language

#41
post #18

Earlier quoted context omitted.

R has much better syntax with tidyverse for data wrangling and even up to models with tidymodels and all. Python in comparison is hard to read.

What... Have you seen the piping syntax in tidyverse? It's incomprehensible unless you put in a lot of effort to understand all that's going on.

This is such an odd take. I program almost exclusively Python these days and I miss the elegance of piped functions daily.

Re: Why Clinical Laboratorians Should Embrace the R Programming Language

#42
post #31

Earlier quoted context omitted.

What is incomprehensible about it?

Grandparent commenter mentioned the piping syntax, specifically.

I dunno, I got pretty sick of writing head(filter(df, value>10)) and it's (a little) easier to indent as df %>% filter(value>10) %>% head().

It's problematic because people abuse it for everything (300 line pipes are common, sadly) but it's a really useful tool in moderation.

Re: Why Clinical Laboratorians Should Embrace the R Programming Language

#43
post #28

Earlier quoted context omitted.

> In R you more packages that do what you expect (mathematically) I disagree with this point explicitly. Many packages are not only poorly written programmatically and systemically, they also produce bad results in common cases and fail silently. This has been discussed well before on our very own YCombinator. https://news.ycombinator.com/item?id=17308554 > is not exactly doing what user need or skips important featu…

> This is why classes are cool You may be unaware, but there are vast similarities between the object system of R and Python, mostly due to their common inheritance from the Art of the Metaobject protocol. They look very different (generic functions vs classes), but they are equally extensible. The trouble with R's systems is that there's three of them, and people use whichever works without really understanding any…

Aware, yes. The point I made before was pointing out that you can implement what you want in Python relatively easy. That R has a wild west set of systems is exactly my point.

Re: Why Clinical Laboratorians Should Embrace the R Programming Language

#44
Reasons I prefer R to python:

- Rmarkdown. I prefer a text document over a web notebook for exploratory research

- The standard library is for statistics and data: dataframe, lm, anova, etc. are builtin

- A huge range of probability distributions are built-in. I don't need to import extra libs to do simulations.

- Between functional programming techniques and vectorization, I can write very clean and concise code

- Tidyverse and data.table are lovely and coherent approaches to data management. Data.table is fast and memory efficient.

- Advanced models are trustworthy: For example, glmnet, mgcv, nlme, rms are authored by statistical heavyweights, and have accompanying books that are excellent. I don't have the same confidence in python's statsmodels.

- CRAN is easy to use, I can access it from my R session, and there are rarely problems (big thanks to Uwe Ligges)

- Libraries for design of experiments and surveys are available. R supports the entire design -> data management -> model cycle.

- base graphics/lattice/ggplot2 are excellent for plotting. If I need something advanced, I can use grid. If I need vector graphics, I can use tikzDevice for latex.

- Rstudio is a an excellent IDE, and Emacs Speaks Statistics is an excellent Emacs plugin

- It is very easy to get help without going to google. (?foo, ??bar, etc) Documentation is well organized, and the documents often contain citations and relevant links.

- Lots of advanced models can't be found outside of R. Today I fit a splines-on-a-sphere model using mgcv (https://stat.ethz.ch/R-manual/R-patched/library/mgcv/html/sm...)

- Rapid iteration in modeling using Wilkinson notation formulas. Built-in formulas are the actual killer app of R, IMO.

- Things are generally fast, but if you need extra horsepower, plugging into c++ is easy using Rcpp.

- R feels like lisp. Experimentation is easy, and I don't feel forced into any particular paradigm while using R. I have a lot of ways to evaluate code (https://ess.r-project.org/Manual/ess.html#Evaluating-code)

Re: Why Clinical Laboratorians Should Embrace the R Programming Language

#45
post #7

My impression is that people outside of maths and statistics are more likely to choose Python than R, because they're able to get started with it more easily. Conventional programmers seem to be somewhat reluctant to learn R's syntax and adjust their programming model. Non-programmer types think in maths even less so they like the python "straightforwardness".

R is used almost exclusively in stats. Most in maths use python, c++ (there's a surprising amount of hpc code, e.g. pde solvers and other stuff floating around in c++), matlab, etc.

No more fortran I guess?

Re: Why Clinical Laboratorians Should Embrace the R Programming Language

#46

I basically worked as an R troubleshooter in a Pharmaceutical company, and honestly I wish python or Julia would take its place. There's so many instances when R would return a nonsense answer rather than fail, but you wouldn't realise until you did a deep dive of someone's code.

It would be so easy to write a very similar article on why clinical laboratories show NOT use 'R' in their analyses. I use 'R' extensively for data presentation, but I am constantly bitten by plots that look great, but do not in fact represent the data, because of some weird "factor" issue. I have never used a language where it is so easy to get beautiful results that are wrong. 'R' has very limited error checking, if it can figure out a way to do something (incorrectly), it's happy to do it. With its hidden 'statefulness' and tricky 'factor' effects, it would be a disaster in the clinical setting. Clinical labs need languages and procedures that will fail, rather than present an incorrect result. Unfortunately, 'R' does the opposite.

Re: Why Clinical Laboratorians Should Embrace the R Programming Language

#47
post #28

Earlier quoted context omitted.

> In R you more packages that do what you expect (mathematically) I disagree with this point explicitly. Many packages are not only poorly written programmatically and systemically, they also produce bad results in common cases and fail silently. This has been discussed well before on our very own YCombinator. https://news.ycombinator.com/item?id=17308554 > is not exactly doing what user need or skips important featu…

> This is why classes are cool You may be unaware, but there are vast similarities between the object system of R and Python, mostly due to their common inheritance from the Art of the Metaobject protocol. They look very different (generic functions vs classes), but they are equally extensible. The trouble with R's systems is that there's three of them, and people use whichever works without really understanding any…

The only thing worse than an object system is...three object systems. I never quite know what is the cool kid implementation, and I don't even like oo.

Re: Why Clinical Laboratorians Should Embrace the R Programming Language

#48

I basically worked as an R troubleshooter in a Pharmaceutical company, and honestly I wish python or Julia would take its place. There's so many instances when R would return a nonsense answer rather than fail, but you wouldn't realise until you did a deep dive of someone's code.

So the question is, who was writing the code and why were they so evidently incompetent? Easy for anyone to pick up a bit of R and start working with it. Thus it's hardly surprising to find the situation you describe. Why weren't these folk put through a rigorous course before being let loose in a pharmaceutical company of all places? Hardly their fault unless they exaggerated their skills.

Re: Why Clinical Laboratorians Should Embrace the R Programming Language

#50
post #44

Reasons I prefer R to python: - Rmarkdown. I prefer a text document over a web notebook for exploratory research - The standard library is for statistics and data: dataframe, lm, anova, etc. are builtin - A huge range of probability distributions are built-in. I don't need to import extra libs to do simulations. - Between functional programming techniques and vectorization, I can write very clean and concise code - T…

Agreed, also R with vim is really a joy to work with (Nvim-R plugin) I can't replicate the experience with any other IDE. For example, I can define my own key bindings to show a certain summary statistic or a custom plot for the variable I'm at.
Post reply on HN