Skip to content
Home ยป Solve ‘The device does not recognize the command’ when saving a file in RStudio

Solve ‘The device does not recognize the command’ when saving a file in RStudio

  • by
  • 2 min read

The following error message is something that me and my colleagues keep running into when using Rstudio.

‘Error Saving File — The device does not recognize the command’

There are multiple things that cause this, but basically it’s because RStudio is having troubles writing to the file.

Here’s what you can check for:

  • Reason 1: The file is opened in another program on your computer, and it’s blocking other software from writing to it. For example, you are editing a CSV file in Microsoft Excel.
  • Reason 2: Your hard or pen drive is out of free space. RStudio does not have enough space to compeletely write away the file.
  • Reason 3: You are working within a file that is stored in a folder that’s being synced by cloud storage software such as Google Drive or Microsoft OneDrive.

For reason 1, you can simply close the other program. In case of reason 2, you should free some space on the drive.

In case of reason 3, you can temporarily pause syncing of your cloud storage. However, you won’t be able to save to the file you want once you start getting to error. What you can do to overcome it, is to create a blank document in RStudio, copy and paste your code into it, and save it with another filename. Now that you paused syncing, you’ll no longer get the error.

By the way, if you’re having trouble understanding some of the code and concepts, I can highly recommend “An Introduction to Statistical Learning: with Applications in R”, which is the must-have data science bible. If you simply need an introduction into R, and less into the Data Science part, I can absolutely recommend this book by Richard Cotton. Hope it helps!

Great success!

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.