Could anyone please explain to me why the following writes nothing into "all.Rout" file? If the "for" loop is removed, t.test output can be written into "all.out". Thanks in advance. Minghua Yao ...... zz <- file("all.Rout", open="wt") sink(zz) for(i in 1:n) { Cy3<-X[,2*i-1]; Cy5<-X[,2*i]; t.test(Cy3, Cy5) } sink() close(zz) ......
Dear Minghua Yao, If you throw in a print() or two you'll get some output in your file. You could try print(t.test(Cy3, Cy5)) or whatever you actually want. Regards, Andrew C. Ward CAPE Centre Department of Chemical Engineering The University of Queensland Brisbane Qld 4072 Australia andreww at cheque.uq.edu.au Quoting "Yao, Minghua" <yao6889 at msmailhub.oulan.ou.edu>:> > Could anyone please explain to me why the following > writes nothing into > "all.Rout" > file? If the "for" loop is removed, t.test output can be > written into > "all.out". > > Thanks in advance. > > Minghua Yao > > ...... > zz <- file("all.Rout", open="wt") > sink(zz) > > for(i in 1:n) > { > Cy3<-X[,2*i-1]; > Cy5<-X[,2*i]; > > t.test(Cy3, Cy5) > } > > > sink() > close(zz) > ...... > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help >
Thanks, Prof. Ripley. Right. I saw nothing, either, when I tried without "for" loop. Does anywhere in the documents mention that Autoprinting does not work inside a for() {} loop? Minghua -----Original Message----- From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] Sent: Tuesday, September 16, 2003 11:35 AM To: Yao, Minghua Cc: R Help (E-mail) Subject: Re: [R] Question in Using sink function Autoprinting does not work inside a for() {} loop, and you did not print anything. Try for(i in 1:10) {i} Did you try your problem without sink()? On Tue, 16 Sep 2003, Yao, Minghua wrote:> > Could anyone please explain to me why the following writes nothing into > "all.Rout" > file? If the "for" loop is removed, t.test output can be written into > "all.out". > > Thanks in advance. > > Minghua Yao > > ...... > zz <- file("all.Rout", open="wt") > sink(zz) > > for(i in 1:n) > { > Cy3<-X[,2*i-1]; > Cy5<-X[,2*i]; > > t.test(Cy3, Cy5) > } > > > sink() > close(zz) > ...... > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >-- 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
Autoprinting does not work inside a for() {} loop, and you did not print anything. Try for(i in 1:10) {i} Did you try your problem without sink()? On Tue, 16 Sep 2003, Yao, Minghua wrote:> > Could anyone please explain to me why the following writes nothing into > "all.Rout" > file? If the "for" loop is removed, t.test output can be written into > "all.out". > > Thanks in advance. > > Minghua Yao > > ...... > zz <- file("all.Rout", open="wt") > sink(zz) > > for(i in 1:n) > { > Cy3<-X[,2*i-1]; > Cy5<-X[,2*i]; > > t.test(Cy3, Cy5) > } > > > sink() > close(zz) > ...... > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >-- 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
Maybe Matching Threads
- How to copy and paste a R plot onto Word (or Power Point)
- How to check cy5 and cy3 values were lowess normalized
- 'RG' looks like a pre-2.4.0 S4 object: please recreate it
- finding most highly transcribed genes - ranking, sorting and subsets?
- Problems in plot