On Fri, Oct 2, 2009 at 6:38 AM, Warnes, Gregory R. <gregory.war...@rochester.edu> wrote: > The current approach effectively blocks users from access data objects named > 'dollar' via the r.dollar syntax. If dollar was a function defined as > > dollar <- .Primitive("$") > > Then the current syntax would continue to work, while still allowing a user > to do > > r("dollar <- 1") > > in which case > > r.dollar > > would return the R vector containing 1, and
Yes. > stackloss.r.dollar("Air.Flow") > > would still work, too. No, this would fail. It translates to the R code dollar(stackloss, "Air.Flow"), and that would fail because dollar is no longer a function. (In rnumpy, the .r attribute on objects is syntactic sugar to make R attribute access more pythonic -- the .r attribute acts like the global r object, except that functions called through it get the relevant object stuck on front of their argument list. So things like my_lm.r.coefficients(), my_lm.r.logLik(), obj.r.attr("foo"), etc., just work. stackloss.r.dollar() doesn't have any additional magic beyond this.) So I'm not sure there's much of a difference in practice between implementing this as a function inserted into the R session, versus a transform applied during Python's name mapping. I just prefer the Python implementation because it seems somewhat easier to explain so that users can understand the consequences, and because I find it easier to reason about behavior when my implemention is in one place (a bunch of python code) rather than spread across two (a bunch of python code interacting with some R code). -- Nathaniel ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list