[R] Question in Using sink function

Yao, Minghua yao6889 at msmailhub.oulan.ou.edu
Tue Sep 16 18:31:41 CEST 2003


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




More information about the R-help mailing list