Hacker News new | ask | show | jobs
by huac 3994 days ago
How easy is it to integrate a chart or graph into a larger project? My biggest gripe with Shiny is how difficult is to use the R calculate and graphing functions in a larger project without using OpenCPU as an API.

My guess is that with Python being a more general purpose language, this should be easier..

4 comments

I've been working on a lightweight API solution for R recently. Still needs a bit of devops tooling, but I think the code is converging on stability.
It shouldn't be too bad. My goal was just to make it a little simpler to do the basic things like formatting the data as json for a particular charting library. The python helpers just set up the APIs. I made an example called custom_react that shows how I mixed some custom code with some pyxley stuff.
For backend monitoring purposes, one common solution is to stand up statsd and consume it from Grafana.
Why you don't want to use OpenCPU?
I've been working with it and it's not bad - won't tear my hair out if it's what I use in the end. But a couple pain points for me are the need to rewrite my code to grab 'session variables', needing to understand how images are returned, especially if you need to return more than one, and so on - versus Shiny, which allows me to more or less drop in the code I've already been working with. Oh, and parallel requests are just not possible.

Of course, most of these issues are understandable and possibly by design, especially since OpenCPU was designed for embedded systems. That's fine - it just makes creating webapps or dashboards around R a more complicated usecase.