Cannot save R scripts

Hello,

I am fairly new to using both R and RStudio, but I have trouble saving (and opening) new and old R scripts. I am working in Windows 10. I am working on a laptop, which has been installed via my university, but I have administrator rights. I currently have R version 3.6.1 and RStudio 1.2.1335. Note that I also tried the RStudio preview version 1.2.1568, but found no difference regarding the following issue:

When I create a new script, I click 'Save As...' and navigate to the folder I want to save it in. Here, I only have the option 'All Files (*)' under 'Save as type'. Even if I write .R after the file name when I try to save the file, I get the following message:

'Confirm Change File Type
The file was created as an R script however the file extension you specified will change it into another file type that will no longer open as an R script.
Are you sure you want to change the type of the file so that it is no longer an R script?'

Then I have the options of 'Yes' or 'No'. If I click 'No', obviously nothing happens and I cannot save the file. If I click 'Yes', I get the following message:

'Error Saving File
The filename, directory name, or volume label syntax is incorrect.'

Thus, I cannot save the file.

As for my previous R scripts, I also cannot open them, neither from RStudio via 'Open File...' nor by first navigating to the folder and double-clicking on the file.
Here, I get the following error message:

'Error while opening file
Access is denied'

Strangely enough, it does seem that I am able to save a new R script to my desktop, but not in my Documents folder.

Any help with this issue would be much appreciated, please let me know if you need any further details or information. Thank you in advance.

This looks like its not an R or RStudio issue but rather about access rights to the directories on your machine:

'Error while opening file
Access is denied'

Or, you may be prevented from writing files with the ".R" extension - some security setting?
I suggest you contact the IT department at your Institution, and show them the problem.

HTH

2 Likes

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