Thanks! (I probably never would have come up with those.) FWIW, I also 
just stumbled across the option of doing numpy.array(summary[3]) which 
gives me a 3x4 array that I can index normally. So, I appear to be fully 
up-and-running now. Thanks!

Gary

P.S. The impetus for the switch was a kind of icky segfault with rpy when 
I was sequentially creating lots and lots (20,000+) data frames from 
dictionaries. I thought I recalled mail-list comments about memory issues 
with rpy, so I thought I'd try rpy2. And, rpy2 is cruising along smoothly 
(45,000 and counting). :-) Great work!

On Fri, 12 Dec 2008, laurent oget wrote:

> I do std-error=r['$'](summary,'sigma')
> I think r.names(summary) will give you the components.
>
> Laurent
>
> 2008/12/12 Gary Strangman <str...@nmr.mgh.harvard.edu>:
>>
>> Hi again,
>>
>> Forgive me if this is a completely silly question for rpy2. I'm trying to
>> wean myself from rpy, but am confused by the new approach to conversion.
>> If I fit a model and collect summary info as follows ...
>>
>> fit = robjects.r.lm(fmla,data)
>> summary = robjects.r.summary(fit)
>>
>> ... the summary variable comes back to python as an RVector. In rpy, it
>> was a dictionary, so if I wanted the coefficient/t-test summary-table I
>> could ask (in python) for summary['coefficients']. In rpy2 it appears I
>> have to ask for summary[3]. That's fine (harder to remember, but fine).
>> However, I can't seem to access any but the first column of the table. To
>> get a nice table I can ...
>>
>>>>> print summary[3]
>>               Estimate Std. Error    t value    Pr(>|t|)
>> (Intercept) 10.9205792  2.9934159  3.6481997 0.001341692
>> prerbmt      0.4226101  0.1729016  2.4442236 0.022599474
>> mri         -0.3495370  0.7497424 -0.4662095 0.645450898
>>
>> ... and if I want the estimate for the 2nd coefficient ...
>>
>>>>> print summary[3][1]
>> 0.4226101
>>
>> But how do I get at the standard errors (or T-values) from python? Or is
>> there a better way to get at the contents of the returned results than
>> integer indexing?
>>
>> More generally, how can one figure out what the components are for the
>> returned RVectors when calling R functions? The examples on the website
>> (nice doc, by the way!) appear to be oriented towards simply displaying
>> the results of R computations rather than retrieving R results for further
>> processing in python.
>>
>> -best
>> Gary
>>
>> ------------------------------------------------------------------------------
>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
>> The future of the web can't happen without you.  Join us at MIX09 to help
>> pave the way to the Next Web now. Learn more and register at
>> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>> _______________________________________________
>> rpy-list mailing list
>> rpy-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rpy-list
>>
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>
>

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to