Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in installation a R package

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

> library(MASS) Error in library(MASS) : there is no package called ‘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’ 

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  

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  

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

like image 658
parvij Avatar asked Oct 26 '14 07:10

parvij


People also ask

Why packages are not installing in R?

Make sure that the package is available through CRAN or another repository, that you're spelling the name of the package correctly, and that it's available for the version of R you are running.

Why is RStudio not installing?

Check firewall, proxy settings, and antimalware 0.1 to the list of approved Hosts and Domains. After this, try restarting RStudio. If you have antimalware software configured that may be blocking RStudio, please check its settings and whitelist RStudio if necessary.

What do I do when R package is not available?

When this happens, it can often be helpful to do a websearch for "GitHub [packagename]" - and if you find a GitHub website that sounds like the right package, you can install the in-development version.


1 Answers

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

Sys.getenv("R_LIBS_USER") 

or

.libPaths() 

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

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

Note that it is possible for the package installation to fail so badly that the lock directory is not removed: this inhibits any further installs to the library directory (or for --pkglock, of the package) until the lock directory is removed manually.

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.

To install pacman use:

install.packages("pacman") 

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. Close out of all R sessions (use task manager to ensure you're truly R session free) Ctrl + Alt + Delete
  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.

like image 160
Tyler Rinker Avatar answered Sep 20 '22 01:09

Tyler Rinker