sink("sink-examp.txt")
i <- 1:10
outer(i, i, "*")
sink()
<!-- % don't show what confuses newbies -->
## capture all the output to a file.
zz <- file("all.Rout", open = "wt")
sink(zz)
sink(zz, type = "message")
try(log("a"))
## revert output back to the console -- only then access the file!
sink(type = "message")
sink()
file.show("all.Rout")
Run the code above in your browser using DataLab