From: hadley wickham Date: 2006-10-16T22:37:16+09:00 Subject: Re: [ANN] RSRuby 0.4 > RSRuby allows the user to embed a full R interpreter into a Ruby > script. This allows the script to call any R function and convert the > result back into Ruby. From the R website: 'R is a free software > environment for statistical computing and graphics.'. Running a > students t-test (or any other R function) is as simple as: > > require 'rsruby' > r=RSRuby.instance #Create R interpreter > ttest = r.t_test([1,2,3]) #Convert [1,2,3] to R. Run t.test > function and convert result back to Ruby > puts ttest['p.value'] #Prints out p.value statistic from the > ttest object That looks really great. However, I have a couple of points about the conversion: - R Logicals (true/false) <=> Ruby true/false - R Integers <=> Ruby Fixnum/Bignum - R Numeric <=> Ruby Float - R String <=> Ruby String These guys are all vectors in R - do you mean vectors of length one are converted to the corresponding Ruby primitives? (Also, confusingly, in R a string is called a character vector of length 1) - R Vector <=> Ruby Array (homogeneous) There isn't really a vector "class" in R, independent of the things listed above. - R List <=> Ruby Hash I think a better mapping would be to Ara's ArrayFields class. Lists in R can be accessed by name or by position. Regards, Hadley