[R] write staff out

kjetil brinchmann halvorsen kjetil at entelnet.bo
Wed May 28 02:11:26 CEST 2003


On 27 May 2003 at 16:01, ZRG (Zeren Gao) wrote:

Maybe capture.output is what you need, new in R-1.7.0

an example:

 capture.output( t.test( rnorm(10), rnorm(10, 2) ) )
 [1] ""                                                              
 [2] "  Welch Two Sample t-test"                                     
 [3] ""                                                              
 [4] "data:  rnorm(10) and rnorm(10, 2) "                            
 [5] "t = -5.5629, df = 16.133, p-value = 4.157e-05"                 
 [6] "alternative hypothesis: true difference in means is not equal 
to 0 "
 [7] "95 percent confidence interval:"                               
 [8] " -2.897467 -1.299261 "                                         
 [9] "sample estimates:"                                             
[10] " mean of x  mean of y "                                        
[11] "-0.1485742  1.9497894 "                                        
[12] ""                            


This also has a file= argument.

Kjetil Halvorsen

> Hi there, 
> I need to output t.test result from R into regular text file, anyone has a suggestion what kind of function to use in what format? 
> thanks a lot. 
> Zeren Gao
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list