Re: [Rpy] How to pass "na.rm=True" to a function

2011-10-02 Thread Wes McKinney
On Sun, Oct 2, 2011 at 4:17 PM, Thomas Kluyver wrote: > On 2 October 2011 20:47, W. Thornton Martin wrote: >> >> z_month = r.aggregate(z1, r['as.yearmon'], r.mean, r['na.rm']=True) >> >> The "na.rm" part does not work, however.  What should the syntax be? > > I believe rpy2 converts . to _ to mak

Re: [Rpy] How to pass "na.rm=True" to a function

2011-10-02 Thread Thomas Kluyver
On 2 October 2011 20:47, W. Thornton Martin wrote: > z_month = r.aggregate(z1, r['as.yearmon'], r.mean, r['na.rm']=True) > > The "na.rm" part does not work, however. What should the syntax be? > I believe rpy2 converts . to _ to make things valid Python names. So try with na_rm=True. Thomas --

[Rpy] How to pass "na.rm=True" to a function

2011-10-02 Thread W. Thornton Martin
How do I pass na.rm=True to a function? I have this R expression: z.month <- aggregate(z1, as.yearmon, mean, na.rm=True) [z1 is a list of zooreg timeseries objects] For the rpy2 code, I think the above should be: from lxml import etree r.library('zoo') r=robjects.r z_month = r.aggregate(z1,