Hi, I got following error in write.table() :> write.table(dataa, file="c:/data1.csv", row.names=F, col.names=T, sep=",")Error in file(file, ifelse(append, "a", "w")) : cannot open the connection In addition: Warning message: In file(file, ifelse(append, "a", "w")) : cannot open file 'c:/data1.csv': Permission denied where dataa is a zoo object> head(dataa)data11 data22 Nov 1980 988.25 194841 Dec 1980 942.38 205732 Jan 1981 935.90 226501 Feb 1981 968.79 227402 Mar 1981 932.77 233490 Apr 1981 906.18 233447 Can please tell me why this error is coming? I am using Windows vista [[alternative HTML version deleted]]
I just managed to write things just fine, and then I recalled that I had a similar problem when teaching our students SPSS (Yes, I know, don't ask...), but the problem was effectively this: If a given file was open in Excel, then that file was locked and no other program could use it until you close the file in Excel. So is perhaps a file called data1.csv already in existence and open in Excel when you try this? Haris Skiadas Department of Mathematics and Computer Science Hanover College On Jun 5, 2008, at 11:57 PM, Megh Dal wrote:> Hi, > > I got following error in write.table() : > >> write.table(dataa, file="c:/data1.csv", row.names=F, col.names=T, >> sep=",") > Error in file(file, ifelse(append, "a", "w")) : > cannot open the connection > In addition: Warning message: > In file(file, ifelse(append, "a", "w")) : > cannot open file 'c:/data1.csv': Permission denied > > > where dataa is a zoo object >> head(dataa) > data11 data22 > Nov 1980 988.25 194841 > Dec 1980 942.38 205732 > Jan 1981 935.90 226501 > Feb 1981 968.79 227402 > Mar 1981 932.77 233490 > Apr 1981 906.18 233447 > > > Can please tell me why this error is coming? I am using Windows vista >
looks like you don't have permission to write a file to C:\ try writing to some other directory where you have write access (e.g., your user's home dir, or your "my documents", or something like that). on 06/05/2008 11:57 PM Megh Dal said the following:> Hi, > > I got following error in write.table() : > >> write.table(dataa, file="c:/data1.csv", row.names=F, col.names=T, sep=",") > Error in file(file, ifelse(append, "a", "w")) : > cannot open the connection > In addition: Warning message: > In file(file, ifelse(append, "a", "w")) : > cannot open file 'c:/data1.csv': Permission denied > > > where dataa is a zoo object >> head(dataa) > data11 data22 > Nov 1980 988.25 194841 > Dec 1980 942.38 205732 > Jan 1981 935.90 226501 > Feb 1981 968.79 227402 > Mar 1981 932.77 233490 > Apr 1981 906.18 233447 > > > Can please tell me why this error is coming? I am using Windows vista > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > 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. >