Imported packages are not installed automatically

I have a private package stored locally (and version controlled via SVN). To install a package, I ask the SVN user to update their packages directory, then setwd()

the directory, and then devtools::install()

.

This package imports many CRAN packages that are not stored locally. These imported packages are not automatically installed during installation, resulting in an error message Dependency package foo not available

. The user must manually set install.packages('foo')

, and then try again, just to get Dependency package bar not available

, ad nauseam, though foo

, and bar

belong to myImports:

Details:

My DESCRIPTION file looks like this:

Package: apackage
Type: Package
Title: Package to Do Stuff
Version: 1.11111
Date: 2017-03-02
Author: C8H10N4O2
Maintainer: C8H10N4O2<C8H10N4O2@example.com>
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 when calling 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:

the packages listed here must be present for your package. Job. In fact, anytime your package is installed, those packages will, if not already present, be installed on your machine (devtools :: load_all () also checks if packages are installed).

I also checked Writing V Extensions , but couldn't find anything else in this section.

I will fix these packages to be an automatic installation, and what should I do to ensure that they are automatically installed?

I understand that the problem is not completely reproducible, but I cannot link to my repo, so I am happy to provide any further details.

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

      

+3


source to share


1 answer


You reinvent packaging with R. I advise. You can just drat create a repository. This is tested and true and works.

And this aspect of deployment, both for creating local packages and using and installing them, is completely orthogonal to where you store the sources. Avoid using the source code repository for the code distribution mechanism.



In sum, using drat locally along with a local GitHub Enterprise instance worked smoothly for us at work, and drat in general is widely used.

(Usual caveats, since I'm the one who started the drat , but I also had a bunch of contributors luck.)

+2


source







All Articles