R中的读取RDS(文件) [英] readRDS(file) in R

查看:15
本文介绍了R中的读取RDS(文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试在 R 中安装软件包时,都会收到以下错误:

Whenever I try to install a package in R, I get the following error:

Error in readRDS(file) : unknown input format

这只是在我系统崩溃后才开始发生的.我在 Windows 7 下运行 32 位 R 2.13.0.我尝试删除并重新安装 R,但仍然出现错误.有什么方法可以在不删除所有内容(即我已安装的所有软件包)并重新开始的情况下解决此问题?

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?

谢谢

推荐答案

以下是我遇到的建议:

  1. 删除运行 R 的目录中的 .Rhistory.RData 文件.
  2. 运行 update.packages()
  3. 尝试检测库目录中的坏文件".你可以在R中做到这一点

  1. Delete your .Rhistory and .RData files in the directory in which you are running R.
  2. Run update.packages()
  3. 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]

删除所有突出显示的文件/目录.如果你真的想的话,你可以使用 file.remove().

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.

只有解决方案 3 对我有用.

Only solution 3 worked for me.

参考:

  • R-sig-Debian 邮件列表
  • 选项 3 是过去几年不同人提供的答案的组合,包括 Chunxiao Xu、Larry Hunsicker 和 Frank Harrell

这篇关于R中的读取RDS(文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆