0

I'm working with R, I have installed the library 'rms' but I have the follow error:

> library(rms)
Error in library.dynam(lib, package, package.lib) : 
  DLL ‘colorspace’ not found: maybe not installed for this architecture?
Errore: package ‘ggplot2’ could not be loaded

What can I do?

IRTFM
  • 258,963
  • 21
  • 364
  • 487
planet
  • 1
  • 1
  • 2
  • What does `.libPaths()` return? What happens if you do `install.packages("ggplot2")`? – Therkel Feb 08 '17 at 12:06
  • [1] "C:/Users/Documents/R/win-library/3.3" [2] "C:/Program Files/R/R-3.3.2/library" > and – planet Feb 08 '17 at 13:53
  • install.packages("ggplot2") Installing package into ‘C:/Users/Documents/R/win-library/3.3’ (as ‘lib’ is unspecified) package ‘ggplot2’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\AppData\Local\Temp\RtmpULADlE\downloaded_packages > library(rms) – planet Feb 08 '17 at 13:54
  • Nothing seems out of the ordinary there. Can you install `install.packages("colorspace")`? – Therkel Feb 08 '17 at 16:44
  • @Therkel: yes, I can install colorspace and when I write library(colorspace) it's ok...there is a problem with ggplot2... – planet Feb 08 '17 at 17:40
  • the installation of ggplot2 is also ok, when I write: > library(ggplot2) Error in get(Info[i, 1], envir = env) : cannot open file 'C:/Users/myname/Documents/R/win-library/3.3/plyr/R/plyr.rdb': No such file or directory Errore: package or namespace load failed for ‘ggplot2’ – planet Feb 08 '17 at 17:45
  • Can you please try `install.packages("ggplot2", dependencies=TRUE)`? – Therkel Feb 09 '17 at 08:03
  • @Therkel:I have unistalled R, then reinstalled it, and now with "install.packages('rms', dependencies=TRUE)" it works!! – planet Feb 09 '17 at 11:51

2 Answers2

0

If you install from base R and wish to install a package and all its dependencies, you need to use the argument dependencies = TRUE. From ?install.packages:

"dependencies = TRUE ... this installs all the packages needed to run pkgs, their examples, tests and vignettes (if the package author specified them correctly).

Hence,

install.packages("rms",dependencies = TRUE)

should do the trick.

Therkel
  • 1,379
  • 1
  • 16
  • 31
0

The answer offered so far (without any upvotes so far) is useful, but incomplete. It is sometimes sufficient to execute install.packages() with dependencies = TRUE, but if the missing package is a dependency of a dependency, then install.package is not "smart" enough to recognize that fact. The ggplot2 package is in the "Depends:" line of the rms package DESCRIPTION file, but colorspace is not. Sometimes the end-user simply needs to read the error message and install the missing dependencies.

In this case, however, it appears that there may have been a version mismatch of packages and R.

IRTFM
  • 258,963
  • 21
  • 364
  • 487