C8H10N4O2
C8H10N4O2

Reputation: 19005

Imported packages do not auto-install

I have a private package stored locally (and version-controlled via SVN). To install the package, I am asking the user to SVN-update his/her package directory, then setwd() on the directory, and then devtools::install().

This package imports many CRAN packages, which are not stored locally. These imported packages are not auto-installing during the installation, which produces the error message Dependency package foo not available. The user must manually install install.packages('foo'), then try again, only to get Dependency package bar not available, ad nauseam, even though foo and bar are among my Imports:

Details:

My DESCRIPTION file looks like:

Package: apackage
Type: Package
Title: Package to Do Stuff
Version: 1.11111
Date: 2017-03-02
Author: C8H10N4O2
Maintainer: C8H10N4O2<[email protected]>
Description: Package that does many useful things
License: file LICENSE
Depends:
    R (>= 3.3.0)
Imports:
    bit64 (>= 0.9.5),
    data.table (>= 1.9.6), 
    extrafont (>= 0.17),
    foreach(>= 1.4.3),
    ggplot2 (>= 2.0.0),
    gbm (>= 2.1),
    grid (>= 3.2.3),
    gridExtra (>= 2.0.0),
    httr (>= 1.1.0),
    readxl (>= 0.1.1),
    scales (>= 0.4.0),
    xlsx (>= 0.5.7)
LazyData: true
RoxygenNote: 5.0.1
Suggests: testthat (>= 0.9.1)

But upon invoking check() or load_all() I still get the error:

Error in (function (dep_name, dep_ver = NA, dep_compare = NA)  : 
  Dependency package gridExtra not available.

And then my user has to install.packages('gridExtra'), and then he/she gets another dependency not available error.

What I have tried:

According to R packages:

Imports: packages listed here must be present for your package to work. In fact, any time your package is installed, those packages will, if not already present, be installed on your computer (devtools::load_all() also checks that the packages are installed).

I also checked Writing R Extensions but couldn't find anything else on this topic.

Am I correct that these packages should be auto-installing, and what should I do to ensure that they auto-install?

I recognize that the problem is not fully reproducible, but I can't link to my repo, so I'm happy to provide any additional details.

**versions**
R 3.4.0, platform = x86_64-w64-mingw32
devtools 1.13.1

Upvotes: 4

Views: 1065

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368221

You are reinventing packaging with R. I advise against. You could just drat to create a repository. This is tried and true and works.

And this deployment aspect, for both production of local packages as well as their use and installation is entirely orthogonal to where you keep sources. Don't mistake a source code repository for code distribution mechanism.

In sum, using drat locally along with local GitHub Enterprise instance has worked swimmingly for us at work, and drat in general is in fairly widespread use.

(Usual disclaimers as I am the one who started drat, but I had the good fortune of a bunch of contributors too.)

Upvotes: 2

Related Questions