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.
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')]
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
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
> 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')]
---
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],
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