[S] warning message ouput

Renaud LANCELOT (lancelot@telecomplus.sn)
Tue, 19 May 1998 11:39:46 +0100


Sorry, it's probably a very basic question, but I cannot find the solution:

How can I send the warning messages into a text file defined by sink() ?

For example, I want the result of

chisq.test(matrix(c(1,6,11,16),nrow=2))

to be sent into a file "test.txt".

If I do:

##################
> sink('test.txt')
> chisq.test(matrix(c(1,6,11,16),nrow=2))
Warning messages:
Warning in chisq.test(matrix(c(1, 6, 11, 16), nrow = 2)): Expected counts
< 5. Chi-square approximation
may not be appropriate.
##################

the warning message appears on the screen but not in the file "test.txt":

Pearson's chi-square test with Yates' continuity correction

data: matrix(c(1, 6, 11, 16), nrow = 2)
X-square = 0.7421, df = 1, p-value = 0.389

Thanks in advance,

Renaud

Renaud Lancelot
Programme PPR
ISRA-URA II
BP 2057
Dakar-Hann (Senegal)

Tel (221) 832 49 02
Fax (221) 821 18 79 / (221) 832 33 34

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news