Re: [Rpy] Access to R lists

2010-02-09 Thread Laurent Gautier
On 2/9/10 5:28 PM, Luca Beltrame wrote: > In data martedì 09 febbraio 2010 15:19:32, John A Schroeder ha scritto: >> If the above does not work, how do I access items in the returned list? > > IIRC you use the rx and rx2 accessors (not sure if they're already there in > RPy2.0.x...). At least in 2.

Re: [Rpy] Access to R lists

2010-02-09 Thread Laurent Gautier
On 2/9/10 4:57 PM, Mark Larsen wrote: >> If the above does not work, how do I access items in the returned list? > > I frequently work like this: > > an_r_list=robjects.r('list(one=1,two=2)') > list_names = [name for name in robjects.r.names(an_r_list)] > value, = an_r_list[list_names.index('one')]

Re: [Rpy] Access to R lists

2010-02-09 Thread Luca Beltrame
In data martedì 09 febbraio 2010 15:19:32, John A Schroeder ha scritto: > If the above does not work, how do I access items in the returned list? IIRC you use the rx and rx2 accessors (not sure if they're already there in RPy2.0.x...). At least in 2.1.x I can do some_list.rx2("name") and get the

Re: [Rpy] Access to R lists

2010-02-09 Thread John A Schroeder
P.O. Box 1625 Idaho Falls, ID 83415-3850 Ph: 208-526-8755 FAX: 208-526-2930 "B.A.D.C.M.D Santos" Sent by: "B.A.D.C.M.D Santos" 02/09/2010 08:04 AM To john.schroe...@inl.gov cc rpy-list@lists.sourceforge.net Subject [Rpy] Access to R lists res = super(RVector, se

Re: [Rpy] Access to R lists

2010-02-09 Thread Mark Larsen
> If the above does not work, how do I access items in the returned list? I frequently work like this: an_r_list=robjects.r('list(one=1,two=2)') list_names = [name for name in robjects.r.names(an_r_list)] value, = an_r_list[list_names.index('one')] ---

[Rpy] Access to R lists

2010-02-09 Thread B.A.D.C.M.D Santos
res = super(RVector, self).__getitem__(i) TypeError: 'str' object cannot be interpreted as an index This answer is pretty much self explanatory. If you have a list or an array you can access is items by using indices. For example list=['a','b'] To access the first element ('a') you do list[0],

[Rpy] Access to R lists

2010-02-09 Thread John A Schroeder
Hello again, I am still working on variations of the "faithful" example. The last thing I need to resolve is how to access R lists (and later maybe data frames) from rpy2 (2.0.8). It seems the following code should allow access to items in the list returned by the 'shapiro.test' object/fun