'write.csv, file extension .csv in Rstudio not working

I am trying to write a csv for my analysis results. Somehow when I use the .csv extenions it does not work. However when I erase the .csv after the file title it makes a general file. I do not understand where the problem is, could anyone help me with that? This is the code:

write.csv(BLUES_overview, "Parameters_Fv_Fm_def.csv")

This is the error I get:

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 'Parameters_Fv_Fm_def.csv': Permission denied



Solution 1:[1]

The error stems from not having write permissions in your working directory:

> setwd("/root")
> write.csv(cars, "cars.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 'cars.csv': Permission denied
> 

You can get your current working directory with getwd() and set it with setwd("/path/to/your/working/directory").

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 0x706A6F