Revision: 465
          http://rpy.svn.sourceforge.net/rpy/?rev=465&view=rev
Author:   lgautier
Date:     2008-03-24 09:32:01 -0700 (Mon, 24 Mar 2008)

Log Message:
-----------
- R is now callable, and will evaluate the string passed as an argument
(just like RPy is currently doing it)

- Renvironment is now iter-able

- Unknown R objects are now mapped to Robject (so it feels more coherent with
the rest)

Modified Paths:
--------------
    branches/rpy_nextgen/rpy/robjects/__init__.py

Modified: branches/rpy_nextgen/rpy/robjects/__init__.py
===================================================================
--- branches/rpy_nextgen/rpy/robjects/__init__.py       2008-03-24 09:04:24 UTC 
(rev 464)
+++ branches/rpy_nextgen/rpy/robjects/__init__.py       2008-03-24 16:32:01 UTC 
(rev 465)
@@ -23,7 +23,7 @@
     elif isinstance(o, rinterface.SexpS4):
         res = RS4(o)
     else:
-        res = o
+        res = Robject(o)
     return res
 
 #FIXME: clean and nice mechanism to allow user-specifier mapping function
@@ -67,6 +67,9 @@
 class Robject(object):
     name = None
 
+    def __init__(self, o):
+        self._sexp = o
+
     def __str__(self):
         tmp = r.fifo("")
         r.sink(tmp)
@@ -188,6 +191,9 @@
         robj = mapperPy2R(value)
         self._sexp[item] = robj._sexp
 
+    def __iter__(self):
+        return iter(self._sexp)
+
 class RS4(Robject):
     def __init__(self, o):
         if (isinstance(o, rinterface.SexpS4)):
@@ -229,6 +235,10 @@
         s += str(self["version"])
         return s
 
+    def __call__(self, string):
+        p = self.parse(text=string)
+        res = self.eval(p)
+        return res
 
 r = R(["--no-save", "--quiet"])
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to