[R] Antwort: Re: Re: sink(): Cannot open file

Sarah Goslee sarah.goslee at gmail.com
Tue May 10 17:17:36 CEST 2016


Try closing the type of sink you're actually opening:


zz <- file("all.Rout", open = "wt")
sink(zz, type = "message")
try(log("a"))
sink(type = "message")
close(zz)
unlink(zz)


If you look carefully at the example in?sink, there are two close
statements, one for each stream being sent to that file.

Sarah

On Tue, May 10, 2016 at 11:05 AM,  <G.Maubach at weinwolf.de> wrote:
> Hi Jim,
>
> I tried:
>
> sink("all.Rout")
> try(log("a"))
> sink()
>
> The program executes without warning or error. The file "all.Rout" is
> begin created. Nothing will be written to it. The file is accessable
> rights after the execution of the program by notepad.exe.
>
> The program
>
> zz <- file("all.Rout", open = "wt")
> sink(zz, type = "message")
> try(log("a"))
> sink()
> close(zz)
> unlink(zz)
>
> creates the file, does not write anything to it and is not accessable
> after program execution in R with notepad.exe.
>
> Any ideas what happens behind the szenes?
>
> Kind regards
>
> Georg
>
>
>



More information about the R-help mailing list