4 ms·
That R is still around while not enjoying the wide array of benefits of general-purpose programming languages is impressive. It must truly have pluses that Pyth
by thanatropism 8y ago
That R is still around while not enjoying the wide array of benefits of general-purpose programming languages is impressive. It must truly have pluses that Python users don't even dream about.
E.g. can you quickly spin up a REST-like HTTP interface for your goods?
- ChrisRackauckas 8y agoRStudio is pretty amazing for interactive statistical work. Also, A lot of open source developers tend to ignore Windows, but the less technical users are on Windows, and so proper Windows support is a key win. R's CRAN has a very clean documentation system and the setup for packages ensures that most things work on Windows (Windows CI is required). Also, its non-standard evaluation and associated metaprogramming is very integrated into the language, so you can build very intuitive APIs. Most users wouldn't know how to program what you just did, but that doesn't matter since the workflow for the average R user is "package-user" not "package-developer". So while R does have quite a few downsides, there's a lot that other general-purpose programming languages can pull from it.
- RosanaAnaDana 8y agoThe big pluses are the huge range of libraries that make developing analyses easier, faster, and more reproducible. Python has some fine libraries, but its leagues behind whats available in R.
- claytonjy 8y agoYes, R has the now-RStudio-supported plumber package (https://github.com/trestletech/plumber https://github.com/trestletech/plumber), roughly flask for R. There's also opencpu (https://github.com/opencpu/opencpu https://github.com/opencpu/opencpu), though the pros/cons of one vs the other has never been clear to me.
- closed 8y ago> roughly flask for R Unfortunately, not even close to flask. Plumber doesn't even handle concurrency... https://www.rplumber.io/docs/runtime.html#performance-request-processing https://www.rplumber.io/docs/runtime.html#performance-reques...
- claytonjy 8y agoFWIW this is on their roadmap, using the future-backed promises package which also powerw async in shiny: https://github.com/trestletech/plumber/pull/248 https://github.com/trestletech/plumber/pull/248
- closed 8y agoThat's fair--I'm definitely looking forward to when it's added, since it will make putting up quick prototypes with R very convenient!
- perturbation 8y agoI've used plumber, and it's pretty easy to get started, though doesn't feel very polished. Handling multipart form data took some hackarounds with the underlying "Rook" package. I'm curious to see how https://github.com/thomasp85/fiery https://github.com/thomasp85/fiery performs and if anyone has used that. May be higher performance than plumber (re: concurrency) because I get the sense from the docs that it's closer to libuv.
- closed 8y agoIn answer to your question -- my sense is that you can spin up super nice dashboards using shiny, and those will be opinionated HTTP interfaces. If you want to combine the flexibility of a bonafide web framework, and R shiny dashboards, you're going to have a rough time. R shiny itself has a pretty rough HTTP implementation built in. So I'd say the answer is yes, and you'll have a good time as long you only need the HTTP interface to do certain things (responsive dashboards; and do them well!). Webserver implementations exist in R, but don't have near the time / attention put into them as with Python.
- nerdponx 8y agoE.g. can you quickly spin up a REST-like HTTP interface for your goods? On the contrary, it started life as a Bell project called S, more or less a math/stats DSL. It was implemented in GNU as R, and R became one of many competing "stats packages" you may or may not be familiar with: SAS, Stata, SPSS, etc. While it can be used for general purpose programming, its main advantage is that it is still primary a math, statistics, and data analysis DSL at heart. The concept of a "data frame" (which you are familiar with if you've used Pandas) as a data structure originated, as far as I can tell, in R. Data frames are built into the language, and the language offers custom syntax support for them. Also, the standard library is full of high-quality statistics tools. Fitted model objects have handsome, human-readable string representations. The formula DSL is elegant and convenient. Manipulating data (replacing missing values, etc) is easy and relatively concise. Math and linear algebra is similarly and it is linked to BLAS so it's pretty fast. Plotting is built into the language and it's pretty intuitive, even if the defaults aren't that pretty. The language is also fully homoiconic and wildly dynamic, allowing you introspect and modify pretty much any chunk of code. And all that's just in the standard library. The package ecosystem is downright enormous. You can write R packages in C/C++ just like in Python if you need something to go fast, aided by Rcpp. There's Shiny, which is a self-contained HTTP server for data-driven web applications. GGPlot2 was a minor revolution in elegant data visualization. The Tidyverse package collection was similarly mold-breaking by letting users write organic "data pipelines" instead of imperative code. Caret is at least as good as Scikit-learn for general-purpose machine learning. XTS takes the pain out of time series manipulation and modeling. Data.table can efficiently join and subset billion-row datasets in memory using indexes. The list goes on. Long story short: - domain-specific niceties - batteries-included standard library that mimics features found in big monolithic stats packages - has general-purpose programming capability - extensible in C for speed - built-in plotting that's not perfect but it's pretty good - huge package ecosystem.
- claytonjy 8y ago> Caret is at least as good as Scikit-learn for general-purpose machine learning Oh how I wish this was true! Luckily RStudio hired the author of Caret to develop a family of smaller tidy modeling packages (https://github.com/tidymodels https://github.com/tidymodels), and with recipes we're finally close to having something like sklearn's Pipelines, which IMO is one of the best parts of sklearn.
- SubiculumCode 8y agoI use R like I use bash for neuroimgaing analysis: I utilize a whole lot of powerful/specialized command line executables (e.g. R lmer|e.g. neurogimaging AFNI) the outputs and inputs of which I link together into a pipeline using R/Bash utilities.
- SubiculumCode 8y agoadmittedly there are tools like nipype that use pythonto create an interface for those different neuroimaging tools, but most of the time bash scripting works perfectly reasonably for this.
- darkhorn 8y ago> E.g. can you quickly spin up a REST-like HTTP interface for your goods? With R? Why would you want to do that with R? R is not suitable as a web server. May be you can write a package for that using C. There are 13170 packages for R. ın fact 99% of R consists of packages. You don't sit and write web server with R. R is used for statistical data analyses. I was using R to get the most occurring error in Apache/PHP error logs, only with 2 lines of R code. https://cran.r-project.org/web/packages/ApacheLogProcessor/index.html https://cran.r-project.org/web/packages/ApacheLogProcessor/i...
- peatmoss 8y agoI dunno, I was able to cobble together a timeseries forecast API using the plummer and forecast packages in an afternoon that a product team was then able to work against to create demos for customers. Yeah, they’d probably eventually want to rewrite the API to be “production ready.” But on the other hand, for prototyping and getting to show something real to prospective customers? Pure dynamite. Even then, if the stats being done in the background were hard to reimplement, I suppose plummer & R could still work with the right cloud / load balancing infra. Might end up being more expensive than it needs to be in the final iteration, but in the meantime money could be flowing in and customers gettin’ happy.
- nirvdrum 8y agoThe article makes mention that FastR supports GraalVM's polyglot mechanism. One possible option for your task is you do your data analysis with FastR and render it with Node on Graal.js or Sinatra on TruffleRuby. At first blush this might not sound all that different from CGI of yore, but the key thing is all Truffle-based languages can optimize with one another. So, when your web server endpoint gets hot, Truffle's PE can inline nodes from FastR and JIT the whole thing with Graal. You get to use the best language for the task at hand and don't have to worry about performance penalties for doing so.
- Bootvis 8y agoShameless plug: Doing something like that is definitely possible, all the parts are there and work well. Shiny gives you a lot out of the box, is great for prototyping and can be customized. I’ve been working on a less opionated package that isn’t ready for anything but gives an idea of what would be possible: https://github.com/bobjansen/mattR https://github.com/bobjansen/mattR