Can’t load Rdata file in RStudio Error in readChar

When trying to load a Rdata file in RStudio and getting an error but it works fine if you load it directly from the file explorer.

load("mydata.Rda")

Output error:

Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file 'mydata.Rda', probable reason 'No such file or directory'

This might be due to a wrong working directory. First navigate to the correct folder. Then hit the menu “More” and select “Set as Working Directory”

Now try to load your data again the R.

load("mydata.Rda")

You should now be able to see it loaded into the global environment.