Skip to content
Back to formatted view

Raw Message

Message-ID: <OF15A2364C.38B38E20-ONC1257FAF.00287156-C1257FAF.0028D3F1@lotus.hawesko.de>
Date: 2016-05-10T07:25:57Z
From: G.Maubach at weinwolf.de
Subject: sink(): Cannot open  file

Hi All,

I would like to route the output to a file using sink(). When using the 
example from the ?sink documentation:

sink("sink-examp.txt")
i <- 1:10
outer(i, i, "*")
sink()
unlink("sink-examp.txt")

## capture all the output to a file.
zz <- file("all.Rout", open = "wt")
sink(zz)
sink(zz, type = "message")
try(log("a"))
## back to the console
sink(type = "message")
sink()
file.show("all.Rout")

I can not open the file in Windows Explorer. The error message is:

"Cannot open file. File is in use be another proces."

How can I close the file in a manner that I can open it right after it was 
created?

Kind regards

Georg