News for hackers. Stuff that matters.
Re:R: Introduction to Data Science by mushufasa on Saturday March 02, 2024 @10:02AM (#39572990)
A few of the main issues I see, as a R user who built his company on python

- when we wanted to build a web app that processes data, it was a lot more straightforward to build both in python, so we can process data within the web servers instead of having to manage multiple stages of infrastructure and different languages. There's no Django for R.

- R will often do something instead of explicitly failing. This is the wrong tradeoff when running a production system, as if you're returning the wrong results to users you may not realize it unless there's an error

- R reproducible builds are worse than python. That's saying something because python is a pretty low bar. But running production systems you can't have builds suddenly fail week over week because one of a hundred packages was updated

Re:R: Introduction to Data Science by doodledoodahs on Saturday March 02, 2024 @10:08AM (#39573025)
> R will often do something instead of explicitly failing.

I mentioned exception handling above, but this is more specifically the problem.

I think it's a hard problem to solve, because the behaviour of older libraries is so varied.

I have sometimes thought that something like a try catch wrapper which pattern matched or tested the value returned would be useful.

Re:R: Introduction to Data Science by hadley on Saturday March 02, 2024 @12:49PM (#39574247)
I have noodled on this problem a bit in https://github.com/hadley/strict, which I'm contemplating bringing back to life over the coming year. It's certainly very difficult to cover 100% of all possible problems, but I suspect we can get good coverage of the most common failure points (specifically around recycling and coercion) with a decent amount of work.
Re:R: Introduction to Data Science by ekianjo on Saturday March 02, 2024 @10:06AM (#39573023)
> one of a hundred packages was updated

There's renv that addresses that point already: https://rstudio.github.io/renv/articles/renv.html

> There's no Django for R.

Nowadays you can integrate R with WebR (WASM) in a web app: https://docs.r-wasm.org/webr/latest/

Re:R: Introduction to Data Science by hadley on Saturday March 02, 2024 @12:48PM (#39574229)
A lighterweight alternative to renv is to use Posit Public Package Manage (https://packagemanager.posit.co/) with a pinned date. That doesn't help if you're installing packages from a mix of places, but if you're only using CRAN packages it lets you get everything as of a fixed date.

And of course on the web side you have shiny (https://shiny.posit.co), which now also comes in a python flavour.

Re:R: Introduction to Data Science by mushufasa on Saturday March 02, 2024 @06:01PM (#39576591)
shiny is nice for one-off data dashboards and single-purpose mini-apps. I see the python equivalents are like dash/plotly. Shiny is not a full fledged web framework, and isn't a viable replacement for e.g. Django.

Aside -- we tried using dash in our production app and then had to remove it after a month, because these types of frameworks that spit out front-end code are almost never flexible enough to do what you actually need to do in a full app context, and you end up doing more work to fight the framework versus the time-savings from the initial prototype.

Re:R: Introduction to Data Science by hadley on Saturday March 02, 2024 @06:28PM (#39576792)
I'd highly encourage you to look into shiny more. No, it's not django, but it's a much richer framework than dash, and you can always bring your own HTML if what it generates for you isn't sufficient.
Re:R: Introduction to Data Science by mushufasa on Sunday March 03, 2024 @03:14PM (#39584064)
I'm not arguing that dash is better than shiny -- I think shiny is probably better!

But the fact that there's no Django for R means shiny's a dead-end for a production web app.

Re:R: Introduction to Data Science by mwavu on Monday March 04, 2024 @04:38AM (#39588576)
> there's no django for R

ambiorix might be what you're looking for.

check it out: https://ambiorix.dev/

it provides: - routing - api generation - templating - web sockets