Re: [R] using the sink() function in a for-look

From: Johannes Hüsing <>
Date: Thu, 01 May 2008 06:40:25 +0200

Tony Dell <> [Thu, May 01, 2008 at 04:32:23AM CEST]:
> hi all,
> i wanted to use the sink function to sequentially output regression
> summaries within a for-loop. i must have something wrong somewhere (or be
> using the sink function incorrectly), but can anyone help?
> the code I am using is:

Please use code and data which is reproducible for us. As we don't have access to your data, we'd have to construct some of our own.

This code, however, has the same effect:

for (i in 1:100) {

    sink("./sometext.txt", append=TRUE)

When you do the following:

for (i in 1:100) {


what output do you get?

And all this output is redirected to your file by sink(), so it works as expected.

Johannes Hüsing               There is something fascinating about science. 
                              One gets such wholesale returns of conjecture  from such a trifling investment of fact.                (Mark Twain, "Life on the Mississippi")

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 01 May 2008 - 04:42:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 01 May 2008 - 05:30:34 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive