Whenever I try to install a package in R, I get the following error:
Error in readRDS(file) : unknown input format
This just started occurring after I had a system crash. I am running 32 bit R 2.13.0 under windows 7. I tried removing and re-installing R, but continue to get the error. Is there any way I can fix this without deleting everything (i.e. all the packages I've installed) and starting over?
Thanks
These are suggestions I have come across:
.Rhistory
and .RData
files in the directory in which you are running R.update.packages()
Try and detect "bad files" in your library directories. You can do this in R
# List the library paths
# The issue is likely to be in the first directory
paths = .libPaths()
## Try and detect bad files
list.files(paths,
pattern = "^00LOCK*|*\\.rds$|*\\.RDS$",
full.names = TRUE)
## List files of size 0
l = list.files(paths, full.names = TRUE)
l[sapply(l, file.size) == 0]
Delete any files/directories highlighted. You could use file.remove()
if you really wanted to.
Delete the directory in which you have stored your downloaded packages.
Only solution 3 worked for me.
Ref: