Trying to save file via dput or write.csv but getting permission errors

Hi, really frustrated and new to R Studio. Trying to save basic data to .csv or .txt and get errors no matter what I do. The below image shows what issues I keep getting. I feel it might be a background setting in windows but my folders have no restrictions. I even tried deleting and reinstalling R studio. Any help is appreciated.

It can be frustrating trying to get RStudio going for the first time. Persist and it will work out.

Writing to a OneDrive folder can sometimes be a problem with R. First of all, try navigating to a folder that you know you can write into locally on a local drive. Perhaps something in My Documents. Just avoid OneDrive for now, even though you know you can write stuff to it outside R.

When you do try the write, try write.table(), as it is a simple routine that should work. I've seldom had to use dput() as it is normally only needed to write the ASCII representation of an R object, and that is not all that common.

Good luck.
Stephen

Thanks. I tried to write both ways to a non Onedrive folder and still the same issue. I'm perplexed.

That's a bit odd, isn't it? Are you sure you can write to that Desktop directory? I would have assumed you would use C:/Users/torsa/My Documents/.

Stephen

I would recommend starting with trying to write and read from a temporary file.

tf <- tempfile()
write.csv(head(iris),tf)
(read_df <- read.csv(tf))

can you confirm this works ?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.