Search code examples
rcran

While I install my R package (for testing) it also re-installs all the dependencies (first time) that are already present on the system


I have a code to track objects in the images. This code uses few function from the package clue. So clue is already installed in my system. Now I have created a package using the same code.

My description file has following lines.

Depends: R (>= 3.4.3),

clue

Because clue is already installed, I thought it will not get installed again when I use install("mypackage"). But to my surprise it re-installed the package. I have tried this with other installed packages, too. When I give it as "depends" or "import", it re-installs the packages. I do not want to re-install the packages if they are already on my system. Is there a way to tell R package installer to avoid re-installing packages that exist on the user's system? Some of these packages are quite large and take a lot of time to install. In addition, I have installed some packages with binary source/dependency that required me to give path for several libraries.


Solution

  • You can just use

    install.packages(..., dependencies = FALSE)
    

    or if you use devtools::install:

    install(..., dependencies = FALSE)