2008/6/25 laurent oget <[EMAIL PROTECTED]>: > Wise Rpy fellows, > > I just came back to using R after a few years and am happy to see that the > RPy project is alive and well, and hope I will be able to provide some help > in the future. > > For now I have a few questions about rpy2: > -is there a document describing the motivation behind the rewrite and the > difference of architecture?
There is no document. There were off-list emails, donated code, the need for a major code clean up (a lot of workarounds no longer necessary with more recent versions of R and Python), the same issues coming up over and over again on the mailing-list. In few bullet points, the rewrite is trying to: a- give a low-level interface (close to R's C interface) b- give a higher level interface built on a- (the doc already mentions a- and b- in the Overview). c- type a little more R objects (like have only R function-alikes callable from Python, etc...) (there are lot of pending issues, good reasons for some of the choices being made, but probably not for other choices... but the most complete technical documentation for both rpy and rpy2 remains the source). The development methodology adopted is probably "cowboy-coding", with a keen eye for unit tests. The "early alpha" is a signal that some development is going on, that it is somewhat working and can be tried out, and inspected, and reviewed. > I am pretty excited to read there will no longer > be conversion modes in rpy2 but the section 4.7 of the documentation is not > giving me much light on what replaces the conversion modes The doc is (still) incomplete. The source code is the primary source of information (and it will reveal that not everything is ironed out yet). > -what is the compelling reason for forcing R>2.7? Is there a significant > change in the C API between 2.6.2 and 2.7 ? R's C-level function "do_slot" only exists since R-2.7.0 and is used in rpy2.rinterface. > > I also have a more pedestrian RPY question: > if m is a matrix in R, how would i get m[,2] in python? That's a good question. In rpy it *should* be (I have not tried it): rpy.r.get("[")(m, True, 2) In rpy2: What is in section 4.4.2 (svn revision 563) applies to all R objects for which the function "[" is defined. >>> import rpy2 >>> import rpy2.robjects as ro >>> m = ro.r.matrix(range(10), 5, 2) >>> print(m) [,1] [,2] [1,] 0 5 [2,] 1 6 [3,] 2 7 [4,] 3 8 [5,] 4 9 >>> m.subset(True, 2) # Note the use of R's recycling rule instead of "missing" >>> parameters list(5L, 6L, 7L, 8L, 9L) >>> I have contemplated the idea of having the method 'subset' defined above in place of the python method '__getitem__'... but I ultimately found it error-prone. Features like R indexes starting at one, and Python indexes starting at zero for example made me prefer two separate method to access items: the Python one (that behaves the way a Python programmer is used to), and the R one. My current dissatisfaction is with the name 'subset' (as it reminds of the R-base function subset, and it is annoyingly longer that the "[" operator __getitem__ benefits from). L. > Thanks, > > Laurent > > ------------------------------------------------------------------------- > 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