[R] Help on R performance using aov function
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Aug 9 12:10:08 CEST 2007
aov() will handle multiple responses and that would be considerably more
efficient than running separate fits as you seem to be doing.
Your code is nigh unreadable: please use your spacebar and remove the
redundant semicolons: `Writing R Extensions' shows you how to tidy up
your code to make it presentable. But I think anova_[[1]] is really
coef(summary(aov_)) which is a lot more intelligible.
On Thu, 9 Aug 2007, Francoise PFIFFELMANN wrote:
> Hi,
> Im trying to replace some SAS statistical functions by R (batch calling).
> But Ive seen that calling R in a batch mode (under Unix) takes about 2or 3
> times more than SAS software. So its a great problem of performance for me.
> Here is an extract of the calculation:
>
> stoutput<-file("res_oneWayAnova.dat","w");
> cat("Param|F|Prob",file=stoutput,"\n");
> for (i in 1:n) {
> p<-list_param[[i]]
> aov_<-aov(A[,p]~ A[,"wafer"],data=A);
> anova_<-summary(aov_);
> if (!is.na(anova_[[1]][1,5]) & anova_[[1]][1,5]<=0.0001)
> res_aov<-cbind(p,anova_[[1]][1,4],"<0.0001") else
> res_aov<-cbind(p,anova_[[1]][1,4],anova_[[1]][1,5]);
> cat(res_aov, file=stoutput, append = TRUE,sep = "|","\n");
> };
> close(stoutput);
>
>
> A is a data.frame of about (400 lines and 1800 parameters).
> Im a new user of R and I dont know if its a problem in my code or if
> there are some tips that I can use to optimise my treatment.
>
> Thanks a lot for your help.
>
> Françoise Pfiffelmann
> Engineering Data Analysis Group
> --------------------------------------------------
> Crolles2 Alliance
> 860 rue Jean Monnet
> 38920 Crolles, France
> Tel: +33 438 92 29 84
> Email: francoise.pfiffelmann at st.com
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list