From: AlexG Date: 2006-04-05T16:13:47+09:00 Subject: Re: Calling R from Ruby Hi, There is a version of my R embedding code at: http://web.kuicr.kyoto-u.ac.jp/~alexg/files This is very very rough and early. Think pre-pre-alpha. It is a conversion of the core part of RSPerl allowing you to call R functions from ruby scripts and pass simple data between them. Simple data means: integers, floats and strings and arrays and hashes thereof. So you can write: require 'rsruby' r=RSRuby.new #initialize embedded R interpreter samples = 100 normal = r.rnorm(samples) #Calls R function 'rnorm' puts normal #a Ruby array of floats converted from R vector r.plot({ 'x' => normal, #You can call with named args 'xlab' => 'Hello Ruby', 'ylab' => 'Ruby ga suki desu'}) sleep(4) #Ooooh - pretty! At this level it doesn't provide anything that Gordon/Ed's suggestion of using an external R interpreter couldn't do. But perhaps with a bit more work it might. Anyway, if you're interested feel free to download and test. I've tried it on a linux box and OSX, I have no idea how to build it under Windows (or even if you could!). Documentation is essentially non-existent at this stage, though there's a README which tells you how to build - you just need to tell extconf.rb where your libR sits. You can find my email address for bug reports/contributions in the DESCRIPTION file. Cheers, AlexG