Skip to content
Prev 360797 / 398506 Next

Antwort: Re: Re: sink(): Cannot open file

George,
I do not know what operating system you are working with, but when I use sink() under windows, I need to specify a valid path which I don't see in your code. I might, for example specify:

sink("c:\myfile.txt")
 R code goes here
sink()

with the expectation that I would create a file myfile.txt that would contain the output of my R program.
 
John


John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
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




Von: Jim Lemon <drjimlemon at gmail.com>
An: G.Maubach at weinwolf.de, 
Kopie: r-help mailing list <r-help at r-project.org>
Datum: 10.05.2016 13:16
Betreff: Re: Re: [R] sink(): Cannot open file



Have you tried:

sink("all.Rout")
try(log("a"))
sink()

Jim
On Tue, May 10, 2016 at 9:05 PM, <G.Maubach at weinwolf.de> wrote:
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Confidentiality Statement:
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.