Saving output from R terminal

Published

December 16, 2024

In order to save output from within R, the sink commmand usually can do the job. Have a look also at the help page.

To save all output:

#! eval: false
zz <- file("all.Rout", open = "wt")
sink(zz)
sink(zz, type = "message")
print(1:10)
 [1]  1  2  3  4  5  6  7  8  9 10
# stop('An eror is an error!')
warning('A warning is a warning!')
Warning: A warning is a warning!
sink(type = "message")
sink()
file.show("all.Rout")