在R中导出为CSV时权限被拒绝 [英] Permission denied when exporting to CSV in R

查看:664
本文介绍了在R中导出为CSV时权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我尝试的代码,我尝试过的方法.基本上,我只是想知道权限拒绝部分.

Here is the code I tried, I tried to ways. Basically I'm just wondering about the permission denied part.

 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

推荐答案

C:/Users/brian_000/Documents(大概是)目录,因此您不能像文件一样对其进行写入.而是写到C:/Users/brian_000/Documents/myfile.csv这样的文件.

C:/Users/brian_000/Documents is (presumably) a directory, so you can't write to it like it is a file. Instead, write to a file like C:/Users/brian_000/Documents/myfile.csv.

这篇关于在R中导出为CSV时权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆