Hi,

I just posted this already on stackoverflow 
(http://stackoverflow.com/questions/10107466/indexing-of-array-in-rpy2), but 
probabably the mailing list is better for getting an answer. So sorry for 
crossposting:

I just started using Python resp. Rpy2 so I am really a beginner. So far I 
manage to get my own R-package loaded via Rpy2 and a result for my input 
variables is produced (comparable to the lm() function of R). My result is a 
following:

>>> res
<ListVector - Python:0x1561828 / R:0xe6a5c8>
[Matrix, Array]
  coef.f: <class 'rpy2.robjects.vectors.Matrix'>
  [-10.554713, 1.640681, 0.957045, ..., 0.000000, 0.000000, 0.783108]
  pred.f: <class 'rpy2.robjects.vectors.Array'>
  [17.189366, 7.116058, 41.526062, ..., 459.952946, 312.088634, 677.908581]
I am also able to get the array subpart (pred.f) by using index 1:

>>>res1 = res[1]
>>> res1
<Array - Python:0x1561850 / R:0x4b299d0>
[17.189366, 7.116058, 41.526062, ..., 459.952946, 312.088634, 677.908581]
>>> print res1
, , L=300, AR=1.5, SO=1, T=30

    sigma_stat sigma_mob
fit  17.189366 152.21461
lwr   7.116058  76.98245
upr  41.526062 301.01379

, , L=300, AR=1.5, SO=2, T=30

    sigma_stat sigma_mob
fit   27.62310  284.5423
lwr   14.54639  173.3316
upr   52.45825  467.1449

, , L=300, AR=1.5, SO=3, T=30

    sigma_stat sigma_mob
fit   39.75894  459.9529
lwr   24.07098  312.0886
upr   65.67369  677.9086
Now I'd like to use a intelligent way to access certain numbers in this array. 
Eg. I'd like the number for sigma_stat,fit,L=300,AR=1.5,SO=3,T=30 ... this 
means my array is 6-dimensional.

Is there an easy way to do that? Something like indexing using the dimension 
names/numbers: res1('sigma_stat','fit','L'=300,'AR'=1.5,'SO'=3,'T'=30)

Thank you for your help...

Maybe you can post the answer also on stackoverflow!
Best regards.

Johannes
-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                          
        
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to