I tried to load my R workspace and received this error:
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning m
I got the error when building an R package (using roxygen2)
The cause in my case was that I had saved data/mydata.RData
with saveRDS()
rather than save()
. E.g. save(iris, file="data/iris.RData")
This fixed the issue for me. I found this info here
Also note that with save()
/ load()
the object is loaded in with the same name it is initially saved with (i.e you can't rename it until it's already loaded into the R environment under the name it had when you initially saved it).