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

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -