Ok, I guess this should work, thank you very much!
However, it means that I have to make an R file everytime I make a 
different analysis. Of course, I could easily make a Python function 
that create the R file and call it... etc...
Maybe I'm a purist, but this juste looks like hacking... isn't it a more 
straight forward way to do it ?

Thank you again, your solution definetly solve my issue!!
-Etienne




Toby Hocking a écrit :
> Why don't you put your R code in file.R:
>
> library('stats')
> my.summary = function(Res) {
>   av <- aov( score~factor+Error(id_subject/factor), data=Res)
>   summary(av)
> }
>
> then from python:
>
> r.source("file.R")
> r.my_summary(Res)
>
> ???
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Etienne Gaudrain
> Sent: Tuesday, December 18, 2007 10:53 AM
> To: rpy-list@lists.sourceforge.net
> Subject: [Rpy] Repeated measure ANOVA : formula and summary problem
>
>
> Hi everyone,
>
> I'm new to RPy, and I came to this terrific module as I was used to make some 
> of my analyses in R, and I came to Python in replacement of Matlab. Formerly, 
> I manipulated data with Matlab, put it in a MySQL database, and made my stats 
> in R via ODBC. I'm now thinking about jumping one step by calling R directly 
> from Python with RPy.
>
> The analysis I almost always have to do is a repeated measure ANOVA. The way 
> I do this in R is :
>
>
> # after odbc connection and sql query, Res contains my data
>
> library('stats')
> av <- aov( score~factor+Error(id_subject/factor), data=Res)
> summary(av)
>
>
> Now I tried the same in RPy :
>
>
> # retrieve data from sql query, Res is a dictionnary
>
> r.library('stats')
> av = r.aov("score~factor+Error(id_subject/factor)", data=Res)
>
>
> This fails saying that "Error" isn't defined in the dataframe...
> After reading some R doc about GLM, I found that using the R function 
> formula() seemed to solve this problem:
>
> av = r.aov(r.formula("score~factor+Error(id_subject/factor)"), data=Res)
> r.summary(av)
>
> However, a new problem rose in r.summary(). This function returns something 
> that isn't readable, and that does not contain the p values, or anything 
> similar. It seems that the r.summary_aov() function might be adequat, but 
> this function returns an Error saying that there is a NaN somewhere...
>
> Does anybody have an advice on how to perform the repeated measure ANOVA?
> Thanks!
> -Etienne
>
>
> PS : I use Windows XP, Python 2.5.1, Numpy 1.0.3.1 and RPy 1.0.1-Numpy-py2.5 
> and R 2.6.1.
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> rpy-list mailing list
> rpy-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rpy-list
>
>
>   


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to