[R-pkg-devel] Package builds, installs, and runs but does not pass devtools::check()

Georgi Boshnakov georgi@bo@hn@kov @ending from m@nche@ter@@c@uk
Sun Jul 15 09:05:07 CEST 2018


It seems that the R session used by 'check' doesn't look in the library used by your interactive session. This discrepancy may happen since the check tools do not load the same Renviron files as interactive sessions. This may result in different libraries in interactive and 'check' sessions. See ?Startup, especially section Note.
It is difficult to give more specific advice without details of your setup.


Hope this helps,
Georgi Boshnakov         


________________________________________
From: R-package-devel [r-package-devel-bounces using r-project.org] on behalf of Michael Hannon [jmhannon.ucdavis using gmail.com]
Sent: 15 July 2018 02:13
To: r-package-devel using r-project.org
Subject: [R-pkg-devel] Package builds, installs, and runs but does not pass devtools::check()

Greetings.  I'm working on a small package, and I'm using the devtools
functions to create, build, etc., the package.

As indicated in the subject line, I get no errors when I do:

    > build()
    > install()

When I run a separate R session and load the package, i.e.,

    > library(my_pkg)

the package loads without error, and the two exported functions appear
to work as advertised.

OTOH, if I include devtools::check() in the construction of the
package, I consistently get an error:

    * installing *source* package ‘my_pkg’ ...
    ** R
    ** preparing package for lazy loading
    Error in loadNamespace(from, lib.loc = .library) :
      there is no package called ‘dplyr’
    Error : unable to load R code in package 'my_pkg'

Clearly there *is* a package called "dplyr" on my system (see the
session info below, for instance).  And, as I've mentioned, the code
*does* run, and I can watch it successfully reading CSV files.

Here's the relevant part of my DESCRIPTION file:

    Depends: R (>= 3.4.4)
    Imports: readr,
            dplyr,
            ggplot2,
            purrr,
            magrittr

I suspect the problem may be that I'm misunderstanding something about
the `import::from()` function, which I'm using for the first time to
load required functions into my code.  In each of the three files that
use dplyr I have the line:

    import::from(dplyr, mutate, filter, rename, select, setdiff, slice, "%>%")

I've tried:

    (1) putting that line in just one of the files (the lexically first one)
    (2) including different subsets of dplyr functions, as needed, in
the various files

Needless to say, I haven't seen any improvement with any of the above
(or any of the other thrashing I've done).

If you can point me in the right direction, I'd appreciate it.  Thanks.

-- Mike


> session_info()
Session info ------------------------------------------------------------------
 setting  value
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, linux-gnu
 ui       X11
 language en_US
 collate  en_US.UTF-8
 tz       America/Los_Angeles
 date     2018-07-14

Packages ----------------------------------------------------------------------
 package    * version date       source
 assertthat   0.2.0   2017-04-11 CRAN (R 3.3.3)
 base       * 3.4.4   2018-03-16 local
 bindr        0.1.1   2018-03-13 CRAN (R 3.4.3)
 bindrcpp     0.2.2   2018-03-29 CRAN (R 3.4.4)
 compiler     3.4.4   2018-03-16 local
 crayon       1.3.4   2017-09-16 CRAN (R 3.4.1)
 datasets   * 3.4.4   2018-03-16 local
 devtools   * 1.13.6  2018-06-27 CRAN (R 3.4.4)
 digest       0.6.15  2018-01-28 CRAN (R 3.4.3)
 dplyr      * 0.7.6   2018-06-29 CRAN (R 3.4.4)
 glue         1.2.0   2017-10-29 CRAN (R 3.4.2)
 graphics   * 3.4.4   2018-03-16 local
 grDevices  * 3.4.4   2018-03-16 local
 magrittr     1.5     2014-11-22 CRAN (R 3.2.2)
 memoise      1.1.0   2017-04-21 CRAN (R 3.3.3)
 methods    * 3.4.4   2018-03-16 local
 pillar       1.3.0   2018-07-14 CRAN (R 3.4.4)
 pkgconfig    2.0.1   2017-03-21 CRAN (R 3.4.0)
 purrr        0.2.5   2018-05-29 CRAN (R 3.4.4)
 R6           2.2.2   2017-06-17 CRAN (R 3.4.0)
 Rcpp         0.12.17 2018-05-18 CRAN (R 3.4.4)
 rlang        0.2.1   2018-05-30 CRAN (R 3.4.4)
 stats      * 3.4.4   2018-03-16 local
 tibble       1.4.2   2018-01-22 CRAN (R 3.4.3)
 tidyselect   0.2.4   2018-02-26 CRAN (R 3.4.3)
 utils      * 3.4.4   2018-03-16 local
 withr        2.1.2   2018-03-15 CRAN (R 3.4.3)
>

______________________________________________
R-package-devel using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list