OK, if 'dollar' is simply an alias for the function name "$", then that seems like it is a reasonable approach...
However, I would implement this in R by defining an R function named dollar in an R package, rather than having rpy2 do a translation. 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 stackloss.r.dollar("Air.Flow") would still work, too. -Greg > -----Original Message----- > From: n...@vorpus.org [mailto:n...@vorpus.org] On Behalf Of Nathaniel > Smith > Sent: Thursday, October 01, 2009 4:15 PM > To: Warnes, Gregory R. > Cc: RPy help,support and design discussion list > Subject: Re: [Rpy] na.action? > > On Thu, Oct 1, 2009 at 10:48 AM, Warnes, Gregory R. > <gregory.war...@rochester.edu> wrote: > > These are the longstanding rpy rules (where 'x' represents any > sequence > > of valid name character in *python*, including A-Z, a-Z anywhere and > 0-9 > > anywhere except in the first position): > > > > python R Example > > x_x x.x print_default(m) --> print.default(m) > > x_ x print_(m) --> print(m) > > Heh -- convergent evolution, then, since I never actually used > "classic" rpy. > > > However, the (proposed?) translation of 'dollar' to '$' seems > > problematic to me, since the string/word 'dollar' can reasonably be > > expected to appear in variable names. > > > > What do you have in mind for that? > > NB: I just double-checked the code, and it's specifically if the name > equals "dollar" exactly then it is translated to "$" -- names that > merely contain "dollar" as a substring are unaffected. > > I think this meets the definition of a "miswart": > http://www.websters-online-dictionary.org/mi/miswart.html > it's ugly looking, but in practice the ability to conveniently access > columns from data frames, etc., outweighs the ugliness. (Of course, if > anyone has an even *better* idea for how to do this, I'd love to hear > it. Typing "dollar" is somewhat ridiculous. I just couldn't deal with > typing r["$"] all the time for such a fundamental operation.) > > The way it looks in practice: > R: stackloss$Air.Flow > Python (rnumpy-style): stackloss.r.dollar("Air.Flow") > > -- 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