Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Ana Nelson
RE: the lattice package [ reply ]  
2009-01-19 20:54
I have found a way to at least work around this by specifying the full method name:

require "rsruby"
r = RSRuby.instance
r.library("lattice")

model = r.eval_R("iris$Sepal.Length~iris$Species")
r.assign("model", model)

r.eval_R("lattice:::print.trellis(bwplot(model))")

http://pastie.org/365026

By: Alex Gutteridge
RE: the lattice package [ reply ]  
2008-02-27 15:06
It's a general problem with (I think) S3 methods in R. The RSRuby runtime can't find the right method (or isn't calling it correctly somehow). It's a big problem with some important libraries so I am keen to fix it.

I'll check that RPy link and see what they are doing there. Thanks

By: Anders Jacobsen
RE: the lattice package [ reply ]  
2008-02-27 15:02
Hi Alex,

I understand that you can not support all of R's obscure libraries.

I am not a RPy user, but I found this one year old bug report (now closed) mentioning the exact same problem in RPy.

https://sourceforge.net/tracker/index.php?func=detail&aid=1634465&group_id=48422&atid=453022

I tried to do something similar in RSRuby, but with no success:

r.print_(eval_R('histogram(~mpg)'))
-or-
r.print_(r.histogram([1,2,2,3]))



By: Alex Gutteridge
RE: the lattice package [ reply ]  
2008-02-27 13:40
Hi Anders,

I'm afraid there's no current solution to this problem. Certain functions in certain libraries just aren't supported by the RSRuby runtime (at the moment). The most I can offer is that I am aware of the problem and it is high on the todo list.

On the off chance that you are an RPy user as well, could you see if RPy currently supports these functions in lattice?

AlexG

By: Anders Jacobsen
the lattice package [ reply ]  
2008-02-22 01:06
Using RSRuby, I can not get the otherwise fantastic 'lattice' plotting functions to produce output to a file or open a X11 graphics window - they only produce 'nil' and no warnings/errors:

>> require 'rsruby'
=> true
>> r = RSRuby.instance
=> #<RSRuby:0x2ae742af8120>
>> r.library('lattice')
=> ["lattice", "stats", "graphics", "grDevices", "utils", "datasets", "methods", "base"]
>> r.eval_R('attach(mtcars)')
=> #<RObj:0x2ae74347c700>
>> r.eval_R('mpg')
=> [21.0, 21.0, 22.8, 21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4, 10.4, 14.7, 32.4, 30.4, 33.9, 21.5, 15.5, 15.2, 13.3, 19.2, 27.3, 26.0, 30.4, 15.8, 19.7, 15.0, 21.4]
>> r.eval_R('histogram(~mpg)') # no graphics output!
=> nil
>> r.histogram([1,2,3,4,4,2,3]) #no graphics output!
=> nil

Any ideas? The above work as expected in an R prompt.
I use Linux, R 2.6.0 and RSRuby 0.4.5 - otherwise most other things work like a charm ...