问题
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