Cannot export data to a file in R (write.csv) -
i trying export data in r csv file, , simple try it, same error message. example:
i create simple data vector export
x <- c(1,3,4,3,5,7,5,8,2,5,7) i try export with:
write.csv(x,file='whatever.csv') and error:
error in file(file ifelse (append w )) cannot open connection in addition: warning message: in file(file, ifelse(append, "a", "w")) : cannot open file 'whatever.csv': permission denied how can solve this?
first part check working directory , ensure have write access directory. can check getwd(). can reproduce error trying write directory read only.
to set working directory else read access can type setwd("h:/foo"). once have write access write.csv(x,file='whatever.csv') should work.
Comments
Post a Comment