From: "M. Edward (Ed) Borasky" Date: 2006-03-30T14:30:02+09:00 Subject: Re: Calling R from Ruby Timothy Goddard wrote: > May I ask what this is for? I've had to learn R recently after working > with Ruby for a while and find myself thinking constantly "This would > be much simpler if I could only use Ruby!". As far as I've worked out > so far: > > R's advantages: > Fast matrix library. > Inbuilt graphing. > Don't have to teach statisticians OO concepts. > Specialised. > > R's disadvantages: > Procedural, with highly limited function support. > Au contraire! R is at heart a functional language with a Lisp ancestry! What's different about R (and S) is two different ways of doing objects and classes, neither one of which is remotely like a Java or Ruby programmer's idea of objects and classes. > Slow loops. > Yeah ... R programmers don't usually use loops -- we use vector and matrix operations that have the loops written in C. :) R is probably more like APL than it is like Ruby, although it does have some Lisp-like and Scheme-like constructs. > Depends on blas (and as a result libfortran). > Depends on blas for linear algebra only. Can hook up to the machine-tuned Atlas linear algebra library if necessary. > Specialised. > True, R is not a general-purpose environment, although you *can* do anything in it. If you look at two of its most successful application areas, bioinformatics and computational finance, you'll find that the "non-numeric" parts of the job aren't *always* done outside of the R code. That's the way most of us learned to use it, and old habits die hard, but I've seen web servers written in R. Check out the "Rpad" library for some really nifty things you can do. > For most purposes, you could do better using Ruby with a good graphing > system (such as gnuplot). There are, of course exceptions, but I would > consider all options first. > Actually, I think that's been done ... one thing Ruby could use is something along the lines of the Perl Data Language/Library. But an "R Server" for numerical work would be easy to do. -- M. Edward (Ed) Borasky http://linuxcapacityplanning.com