On Sun, Feb 8, 2009 at 2:22 AM, Laurent Gautier <lgaut...@gmail.com> wrote: > In the case of extracting elements from a matrix, there is a way > (working in R, as well as in rpy2): > > m[2, TRUE] # Note the TRUE ! > [1] 2 4
Ah, cute trick, thanks. > I'd be more keen on defining the missing magic, as well as NULL and the NA_* > group as user-immutable objects in a module (rather than functions). > I started looked at how this could happen with the NA_* group, but got too > busy on the day job otherwise and had to interrupt half-way through. > One point of concern is that that those variables are not valid until R is > initialized. This is rather easy to solve when considering the use of > functions such as getNA_REAL() or getMissingArg(), but not when considering > non-callable objects in a module. Well, I agree that attributes look nicer, but like you say, the way I did it has the advantage of actually working :-). One could just add the line MISSING = rinterface.getMissingArgSexp() to robjects/__init__.py and have the nice API that way. (It wouldn't be immutable in the same way, but that's true of basically everything in the entire Python world, including __builtins__, so that doesn't seem too bad.) Alternatively, why not just initialize R unconditionally at rinterface import time? In practice everyone does this anyway (because they import robjects rather than rinterface), and since R actually cannot be initialized/deinitialized/reinitialized anyway, there isn't much use in exposing the functions to do it. And it would make all this stuff trivial. -- Nathaniel ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list