write.table() results in permission denied - common solutions don't work [duplicate]

别说谁变了你拦得住时间么 提交于 2021-01-28 18:51:07

问题


Can't seem to get permission to write files in R.

Using Windows 10. Only one user account in my computer, have tried running RStudio and Rgui as administrator. getwd() confirms 'C:/Users/name/R' is my working directory. I've gone to properties of the folder and SYSTEM and user have all permissions to write. Have tried changing the directory to no avail.

Using write.table(dataframe, "C:/Users/name/R", sep = "|") and I get the following error:

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/name/R': Permission denied


回答1:


The path you give to write.table should name a file. You have it naming a directory. R won't replace that directory with a file (thank goodness).

Try this:

write.table(dataframe, "C:/Users/name/R/dataframe.txt", sep = "|")


来源:https://stackoverflow.com/questions/54244412/write-table-results-in-permission-denied-common-solutions-dont-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!