这是我试过的代码,我尝试了一些方法。基本上我只是想知道被拒绝的部分。
data <- matrix(c(1,2,3,4), ncol=2)
write.csv(data,"C:/Users/brian_000/Documents")
错误:
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:/Users/brian_000/Documents': Permission denied
write.csv(data, file="C:/Users/brian_000/Documents")
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:/Users/brian_000/Documents': Permission denied
答案 0 :(得分:10)
C:/Users/brian_000/Documents
(大概)是一个目录,所以你不能像它是一个文件那样写它。而是写入C:/Users/brian_000/Documents/myfile.csv
等文件。
答案 1 :(得分:0)
我在执行时遇到了相同的错误:
tip_data <-read.csv('my_tipdata.csv',标头= TRUE)
是因为我在Excel中打开了文件。关闭文件后,文件可以正确执行。