Message-ID: <OFE75E365B.FBDCB581-ONC1257FB0.005B5E6B-C1257FB0.005C1243@lotus.hawesko.de>
Date: 2016-05-11T16:45:39Z
From: G.Maubach at weinwolf.de
Subject: Antwort: Re: Re: Antwort: Re: Re: sink(): Cannot open file
In-Reply-To: <CAM_vjukqpe_wUvsycbGM-4_CAGeG2Qu+bkvQe=53hkSN+zQt9A@mail.gmail.com>
Hi Sarah,
yes, I followed your suggestion.
If I do exactly what is in the example of the documentation:
sink("C:/Temp/sink-examp.txt")
i <- 1:10
outer(i, i, "*")
sink()
unlink("C:/Temp/sink-examp.txt")
it does not write anything, i. e. no file is created in "C:/Temp/". The
script is executed without an error or warning message.
If I run
## capture all the output to a file.
zz <- file("C:/Temp/all.Rout", open = "wt")
sink(zz)
sink(zz, type = "message")
try(log("a"))
## back to the console
sink(type = "message") # I think ,this was your suggestion
sink()
unlink("C:/Temp/all.Rout")
the script is executed without error or warning message, the file is
created in "C:/Temp/" but if I try to open it right away after the script
is done the message
DE: "Auf das Dokument "C:\Temp\all.Rout" kann nicht zugegriffen werden, da
es von einer anderen Anwendung verwendet wird."
EN: "Cannot access the document "C:\Temp\all.Rout" cause it is used by
another application."
What do I do wrong?
Kind regards
Georg
Von: Sarah Goslee <sarah.goslee at gmail.com>
An: G.Maubach at weinwolf.de,
Datum: 10.05.2016 18:46
Betreff: Re: Re: [R] Antwort: Re: Re: sink(): Cannot open file
On Tue, May 10, 2016 at 12:34 PM, <G.Maubach at weinwolf.de> wrote:
> sink(type = "message")
But did you do that ^^ as I suggested?
If you start a message sink with
sink(zz, type="message")
as you did, you need to explicitly close that stream. Just using
sink()
doesn't do it.