本文介绍了安装R软件包时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我,我无法安装"MASS"软件包.

Please help me, I cannot install "MASS" package.

> library(MASS)
Error in library(MASS) : there is no package called ‘MASS’

我尝试从本地安装MASS软件包:

I tried to install MASS package from local:

> utils:::menuInstallLocal()
package ‘MASS’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘MASS’

即使我无法删除"MASS":

Even I cannot remove "MASS":

> remove.packages("MASS")
Removing package from ‘C:/Program Files/R/R-3.0.1/library’
(as ‘lib’ is unspecified)
Error in find.package(pkgs, lib) : there is no package called ‘MASS’

同样使用此选项,我无法安装软件包:

Also with this option I couldn't install package:

> options(install.lock=T)
> utils:::menuInstallLocal()
package ‘MASS’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘MASS’
Warning: restored ‘MASS’
Warning message:
In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Program Files\R\R-3.0.1\library\00LOCK\MASS\libs\x64\MASS.dll to C:\Program Files\R\R-3.0.1\library\MASS\libs\x64\MASS.dll: Permission

以及install.packages:

And with install.packages:

> install.packages("C:\\MASS_7.3-35.zip",repos=NULL)
package ‘MASS’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘MASS’
Warning: restored ‘MASS’
Warning message:
In file.copy(savedcopy, lib, recursive = TRUE) :
  problem copying C:\Program Files\R\R-3.0.1\library\00LOCK\MASS\libs\x64\MASS.dll to C:\Program Files\R\R-3.0.1\library\MASS\libs\x64\MASS.dll: Permission

我应该提到我将R与ORE(Oracle R Enterprise)一起使用.

I should mention I use R with ORE (Oracle R Enterprise).

推荐答案

这里可能发生了一些事情.首先确定您的图书馆位置:

There could be a few things happening here. Start by first figuring out your library location:

Sys.getenv("R_LIBS_USER")

.libPaths()

我们已经从您提供的信息中了解了您: C:\ Program Files \ R \ R-3.0.1 \ library

We already know yours from the info you gave: C:\Program Files\R\R-3.0.1\library

我相信您那里有一个名为:00LOCK的文件.来自?install.packages:

I believe you have a file in there called: 00LOCK. From ?install.packages:

您需要删除该文件.如果您安装了pacman软件包,则只​​需使用p_unlock()并删除00LOCK文件.在删除00LOCK文件之前,现在无法安装pacman.

You need to delete that file. If you had the pacman package installed you could have simply used p_unlock() and the 00LOCK file is removed. You can't install pacman now until the 00LOCK file is removed.

要安装pacman,请使用:

install.packages("pacman")

可能还有第二个问题.这是您以某种方式损坏了MASS的地方.以我的经验,如果您尝试在另一个R会话中使用某个程序包时对其进行更新,则可能会发生这种情况.我相信还有其他方法也可以导致这种情况.要解决此问题,请尝试:

There may be a second issue. This is where you somehow corrupted MASS. This can occur, in my experience, if you try to update a package while it is in use in another R session. I'm sure there's other ways to cause this as well. To solve this problem try:

  1. 关闭所有R会话(使用任务管理器以确保您真正没有R会话) + +
  2. 转到您的图书馆位置Sys.getenv("R_LIBS_USER").您的情况是: C:\ Program Files \ R \ R-3.0.1 \ library
  3. 手动删除MASS程序包
  4. 启动R的原始会话
  5. 通过install.packages("MASS")
  6. 安装MASS
  1. Close out of all R sessions (use task manager to ensure you're truly R session free) + +
  2. Go to your library location Sys.getenv("R_LIBS_USER"). In your case this is: C:\Program Files\R\R-3.0.1\library
  3. Manually delete the MASS package
  4. Fire up a vanilla session of R
  5. Install MASS via install.packages("MASS")

如果其中任何一项有效,请告诉我什么有效.

If any of this works please let me know what worked.

这篇关于安装R软件包时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 05:25