Skip to content
Prev 334497 / 398506 Next

Invalid connection error message when trying to write a file

Thanks for pointing out my error after specifying the destination in the 
file(  ) function.  What you proposed also did not work.
It turns out the solution is to give the file name but not include the path; 
the resulting file is written in the working directory.
The mystery is that including the path had previously work.
John Karon

-----Original Message----- 
From: Uwe Ligges
Sent: Sunday, December 15, 2013 12:30 PM
To: John Karon ; r-help at r-project.org
Subject: Re: [R] Invalid connection error message when trying to write a 
file
On 15.12.2013 20:13, John Karon wrote:
Wrong, *either* use

write.table(LRtest.out, file="c:\\LRtest.txt", sep="\t")

or

zz <- file(description="c:\\LRtest.txt","w")
write.table(LRtest.out, file=zz, sep="\t")
close(zz)

Best,
Uwe Ligges