With the new alpha, z.subset('y')[0] can also be written as z.r['y'][0]
I am sometimes checking with R-devel and Python-2.6, and last time I did it was doing ok. Thanks for reporting any error you would notice. To run the automated tests (and see that there are still issues with the current R and Python): import rpy2.tests import unittest suite = rpy2.tests.suite() # increase the verbosity level if needed unittest.TextTestRunner(verbosity=0).run(suite) 2008/6/26 Sean Davis <[EMAIL PROTECTED]>: > On Wed, Jun 25, 2008 at 5:30 PM, Laurent Gautier <[EMAIL PROTECTED]> wrote: >> 2008/6/25 Sean Davis <[EMAIL PROTECTED]>: >>> First, Laurent, I am giving rpy2 a try and REALLY like what I see so >>> far. It is very much more intuitive, both from the point-of-view of >>> an R programmer as well as for python programmers. >>> >>> Data frames are very nice R data structures, so I would like to >>> capitalize on them and the changes included in rpy2 as much as >>> possible. So, how can I access the members of y (the data.frame)? If >>> one uses list subsetting, the values are actually reversed. I figured >>> out that y.getNames() will return the names of z, which I can then use >>> to determine the list position. Is there a way to do this with the >>> column names directly? >>> >>> In [34]: z = ro.r['data.frame'](x=ro.r.c(1,2,3,4),y=ro.r.c(5,6,7,8)) >>> >>> In [35]: z >>> Out[35]: >>> structure(list(y = 5:8, x = 1:4), .Names = c("y", "x"), row.names = c(NA, >>> -4L), class = "data.frame") >>> >>> In [36]: z[0] >>> Out[36]: 5:8 >>> >>> In [37]: z[0][1] >>> Out[37]: 6 >>> >>> In [38]: z.getNames() >>> Out[38]: c("y", "x") >>> >> >> >> z.subset('y') >> returns a list, because data.frames are R lists, and R lists are >> recursive structures. >> >> z.subset('y')[0] >> should make it. >> >> The method "subset" mimics R's "[". There is probably the need for a >> counterpart to R's "[[". >> >> There will also be a proper class for data.frame (but that will be in July). > > Great. I look forward to it! Oh, by the way, I am doing my testing > on R-devel and things are going fine. > > Sean > >>> Thanks, >>> Sean >>> >>> ------------------------------------------------------------------------- >>> Check out the new SourceForge.net Marketplace. >>> It's the best place to buy or sell services for >>> just about anything Open Source. >>> http://sourceforge.net/services/buy/index.php >>> _______________________________________________ >>> rpy-list mailing list >>> rpy-list@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/rpy-list >>> >> >> ------------------------------------------------------------------------- >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/index.php >> _______________________________________________ >> rpy-list mailing list >> rpy-list@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/rpy-list >> > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > rpy-list mailing list > rpy-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rpy-list > ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list