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
Ok, so how do I work out the indices? The following is an edited dump of
the contents of the list returned by 'shapiro.test'. The structure is
complicated and the documentation describes the list in terms of the named
components. It is not apparent how to use indices to access the "W" or
> 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