Dear List,

I am trying to get R's terminal output to a file and to the terminal  
at the same time, so that I can walk through some tests and keep a log  
concurrently. The function 'sink' with the option split=TRUE seems to  
do just that. It works fine for most output but for objects of class  
htest, the terminal output is incomplete (the lines are there but  
empty). Here is an example session which shows the problem:

 > sink("textout.txt", type="output", split=T)
 > b=bartlett.test(runif(10),c(1,1,1,1,2,2,2,2,2,2))
 > class(b)
[1] "htest"
 > b


data:  runif(10) and c(1, 1, 1, 1, 2, 2, 2, 2, 2, 2)

 > t=t.test(runif(10),c(1,1,1,1,2,2,2,2,2,2))
 > t


data:  runif(10) and c(1, 1, 1, 1, 2, 2, 2, 2, 2, 2)
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
  -1.5807338 -0.7316803
sample estimates:
mean of x mean of y
0.4437929 1.6000000

 > sink()       # output in the file is complete
 > b

        Bartlett test of homogeneity of variances

data:  runif(10) and c(1, 1, 1, 1, 2, 2, 2, 2, 2, 2)
Bartlett's K-squared = 0.9959, df = 1, p-value = 0.3183

 > t

        Welch Two Sample t-test

data:  runif(10) and c(1, 1, 1, 1, 2, 2, 2, 2, 2, 2)
t = -5.7659, df = 16.267, p-value = 2.712e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
  -1.5807338 -0.7316803
sample estimates:
mean of x mean of y
0.4437929 1.6000000

 >

Is this a known bug (I'm using R 2.6.1 on OS X and Linux - FC8)? Is  
there an inherent reason why some portions of this output are not  
redirected?

Thank you in advance for your help.

JiHO
---
http://jo.irisson.free.fr/

______________________________________________
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.

Reply via email to