Cannot export data to a file in R (write.csv)

> write.csv(x,"trail.csv", row.names = FALSE)
Error in file(file, ifelse(append, "a", "w")) :
  cannot open the connection
Calls: write.csv -> eval.parent -> eval -> eval -> write.table -> file
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
  cannot open file 'trail.csv': Permission denied
Execution halted
Sol. Set working directory correctly. I set using setdw() and it worked for me successfully without any error.

No comments:

Post a Comment

7 Stages of Machine Learning - Framework Introduction

Framework Introduction 7 Stages Introduction Stage 1: Problem Definition Stage 2: Data Collection Stage 3: Data Preparation Stage 4: Data Vi...