[R] sink to file
Thomas Lumley
tlumley at u.washington.edu
Fri Feb 4 19:17:40 CET 2005
On Fri, 4 Feb 2005, Uwe Ligges wrote:
> Urs Wagner wrote:
>
>> Hello
>>
>> I would like to use the source(command) and write the output into a file.
>> I am using
>>
>> outputfile=file("output.txt", open="wt")
>> sink(outputfile, type="output")
>> source("input.R", echo=TRUE)
>>
>> Unfortunately the result has prompted commands. How can I avoid the
>> prompted commands data(iris), ...?
>
> By *not* specifying echo=TRUE in source, but print()-ing the summary below.
>
There is also a print.eval= argument to source(), so that printing of the
output can be controlled independently of echoing the input.
-thomas
More information about the R-help
mailing list