2010/2/24 Luca Beltrame <luca.beltr...@unifi.it>:
> Hello,
>
> thanks from the help on this ML, porting is going on fast. However I've
> again(!) stumbled upon something that is not very evident (at least to me):
> null results.
>
> In R, accessing non existent items from a list yields a NULL result, and since
> some of the methods I use can or can not return something, I check for the
> result using is.null().
>
> Simple use case
>
> test_list <- list(a="some_value", b="other_value")
>
> test_list[["c"]]
> NULL
>
> However, rpy2 returns a RObject which is not None (obviously) but can't be
> tested for such a thing, unless I do:
>
> importr("base")
> base.is_null(test_list.rx2("c"))
> True
>
> Is there another way to go around this problem or should I stick with this
> solution for now?

For now, you may have to stick with that or with

from rpy2.rinterface import R_NilValue
NULL = R_NilValue

test_list.rx2("c").rsame(NULL)

The plan is to have a singleton of type RNULL (or similar), which
would let one do:

test_list.rx2("c") is RNULL

There is something similar in place for NAs (unfortunately not
extremely stable until 2.1beta).

Laurent


> Thanks.
>
> --
> Luca Beltrame, Ph.D.  - luca.beltr...@unifi.it
> Post-doctoral research fellow - Duccio Cavalieri group
> Department of Pharmacology, University of Firenze
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to