writing .csv file
Title
Question
<span style="background-color: rgb(255, 255, 204);">write.csv(captaincy,"NewCaptaincy.csv", row.names = FALSE)</span>
by using the above code, I am getting an 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 'NewCaptaincy.csv': Permission denied
how to solve this?
R Introduction-to-Data-Frames-in-R 09-10 min 10-20 sec
Answers:
Try specifying the path where you want to save your file.
I am getting the following error while executing write.csv(captaincy,"NewCaptaincy.csv")
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 'NewCaptaincy.csv': Permission denied
The solution to above error is as below:
Go to RHS of R Studio Window & Locate Files (The tabs mentioned there are Files, Plots, Packages, Help, Viewer)
Click on Files
By default the location of file directory is C:/windows/system32 followed by ...
Click the ... after the file name
It will show the file path where you want to save the file (I Chose it as below)
I first created a folder named My Project on Desktop, Thereafter I chose the file path by clicking on ... on R Studio as C:/Users/Desktop/My Project
Thereafter, click on Settings icon just above ... & select set as working directory
Thereafter, execute the command write.csv(captaincy,"NewCaptaincy.csv")
OR
In console window type:
setwd("C:/Users/Desktop/My Project") & press enter & execute your command write.csv(captaincy,"NewCaptaincy.csv")
The above solution worked for me, if anyone faces the same error, kindly give it a try.
Thank you...!!!
Login to add comment