'Exporting CSV file in R/R studio: permission denied
Cannot export CSV file using {write.csv} because of permission denial:
#create file
x <- c(1,3,4,3,5,7,5,8,2,5,7)
#export file
write.csv(x,file="whatever.csv")
I always get this 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 'whatever.csv': Permission denied
I tried opening R studio with admin rights, reboot PC, close eveything (including excel): permission still denied... any clues?
Solution 1:[1]
Check your actual working directory with getwd(), set your working directory in the beginning with setwd("C:\\users\\yourname\\") or try to use a specific folder, like:
write.csv(x,file="C:\\user\\yourname\\whatever.csv")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
