[R] Question in Using sink function

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Sep 16 18:35:12 CEST 2003


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