[R-pkg-devel] DBI namespace not found on check
On 01/02/2022 12:29 p.m., Dayne Filer wrote:
I see. And yes, I could only track DBI down though suggests from knitr & S4Vectors. The best answer then, it to suggest DBI?
That should be sufficient, but I think in the previous case it may have triggered a different message. The theory is that your package should gracefully handle situations where suggested packages aren't present, by testing for them and falling back to some message to the user if they are not present. The only way I know to do that for objects in the data directory is with a script to load them, as described in the previous thread. Your script should work whether or not DBI can be loaded. If it can't be, it's fine to give a message (not an error) that you loaded a stub instead of the requested dataset (or maybe not to load anything at all, I'm not sure). Duncan Murdoch
Thanks, Dayne
On Feb 1, 2022, at 12:25 PM, Duncan Murdoch <murdoch.duncan at gmail.com <mailto:murdoch.duncan at gmail.com>> wrote: On 01/02/2022 12:13 p.m., Dayne Filer wrote:
Thanks, Ivan! I completely missed the warning in the install.out file and had no idea where this was coming from. The object has a slot with a class inheriting from the S4Vectors package. Based on the very helpful thread you suggested, it appears that is the crux. The odd thing is that unlike the ade4 package which was NOT importing anything from the offending sp package, I list S4Vectors as an import. Why would, if the S4Vectors package has some dependencies on the DBI package (probably by way of the AnnotationDbi package?) would DBI not be installed?
S4Vectors is a Bioconductor package, and its current version (0.32.3) doesn't list any imports. ?It has just one non-base dependency (BiocGenerics) and a list of 10 suggested packages. These dependencies may be different if you have a different version. Normally suggested packages of the one being tested are loaded, but not suggested packages of packages it uses. ?So it's probably one of those suggested packages that needs DBI. Duncan Murdoch
Thanks, All! Dayne
On Feb 1, 2022, at 10:14 AM, Ivan Krylov <krylov.r00t at gmail.com <mailto:krylov.r00t at gmail.com>> wrote: On Tue, 1 Feb 2022 08:27:54 -0500 Dayne Filer <dayne.filer at gmail.com <mailto:dayne.filer at gmail.com>> wrote:
I do not directly import or use any DBI functions.
00install.out says:
Warning: namespace ?DBI? is not available and has been replaced by .GlobalEnv when processing object ?txp_example_model?
Should the txp_example_model object reference the DBI namespace? I don't know the "right" solution here, but a similar problem has been discussed here in R-pkg-devel some time ago: https://stat.ethz.ch/pipermail/r-package-devel/2022q1/007633.html <https://stat.ethz.ch/pipermail/r-package-devel/2022q1/007633.html> You might have to depend on DBI explicitly because your data() object uses it, but then `R CMD check` might object that you don't explicitly import anything from it. One admittedly verbose way to work around that would be to move the data file to inst/ and load it from data/txp_example_model.R only after loadNamespace('DBI'), like some data scripts do in the Matrix package. -- Best regards, Ivan
______________________________________________ R-package-devel at r-project.org <mailto:R-package-devel at r-project.org>mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel <https://stat.ethz.ch/mailman/listinfo/r-package-devel>