---------- Forwarded message ---------- From: Adel ESSAFI <adel.s...@imag.fr> Date: 2010/6/5 Subject: Re: [R] How to make R automatic? To: zhangted001 <zhen...@gmail.com>
Well, I am new but i will give you an example of script that I run cat exec2.sh R --no-save << EOF fl=list.files(pattern="*.dat") for( j in 1:length(fl)){ a=read.table(fl[j]) debut=a[,1] fin=a[,2] duree=a[,3] u=matrix(ncol=1,nrow=length(fin)-1) for( i in 1:length(fin)-1) u[i]=debut[i+1]-fin[i] if (! (is.na(mean(duree)) || is.na(sd(duree)) || is.na(mean(u)) || is.na(sd(u) ) ) ) { cat (fl[j]," ",mean(duree)," ",sd(duree)," ",mean(u)," ",sd(u)," ",trunc((mean(duree)/(mean(duree)+mean(u)))*100)," ",length(debut), "\n",file="testlogsnavai",append=TRUE) } } This works perfect 2010/6/5 zhangted001 <zhen...@gmail.com> > Thank you all for the information! That is exactly what I was looking for. > > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-make-R-automatic-tp2238541p2244132.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org 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. > -- PhD candidate in Computer Science Address 3 avenue lamine, cité ezzahra, Sousse 4000 Tunisia tel: +216 97 246 706 (+33640302046 jusqu'au 15/6) fax: +216 71 391 166 -- PhD candidate in Computer Science Address 3 avenue lamine, cité ezzahra, Sousse 4000 Tunisia tel: +216 97 246 706 (+33640302046 jusqu'au 15/6) fax: +216 71 391 166 [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org 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.