R packages: Missing "suggests" dependency during installation.

Hi folks!

I've encountered an intriguing issue while conducting a package installation process. Currently, I'm working on R version 4.2.1 within the Posit Workbench 2023.03.1+446.pro1, “Cherry Blossom” environment.

I've developed a package named APIUtilizeR and subsequently uploaded it to our internal POSIT Package Manager. Within the DESCRIPTION file of this package, certain dependencies are specified under the Suggests section, including:

    lintr (>= 3.1.1),

Notably, the package 'RSQLite' is included for testing purposes solely, as depicted in the attached image:

My understanding was that by labeling it under 'Suggests', the package 'RSQLite' would be exclusively required during testing procedures. However, upon attempting to install the package using install.packages("APIUtilizeR") , the following error is encountered:

Error in check_installed(package) : The package "RSQLite" is required.
Error: unable to load R code in package ‘APIUtilizeR’
Execution halted
ERROR: lazy loading failed for package ‘APIUtilizeR’

The occurrence of this error seems perplexing since 'RSQLite' is annotated under 'Suggests', implying it's not necessary for the core functionality and therefore the installation of the package. Nevertheless, the failure of the installation process suggests otherwise.

Could there be a misconception on my part concerning the distinction between 'Imports' and 'Suggests' in the DESCRIPTION file? Any insights or clarifications on this matter would be greatly appreciated.

usethis::use_package() is not something that you need call from package code. You run this function once, interactively, to insert the dependency into the DESCRIPTION file.

hey @Gabor
thanks for your answer.

Ok i see your point. So currently I have a file in the R folder with all the usethis::use_package() command. What do you suggest where to place such a file within a package structure?

Well, you don't really need to re-run this file, so one solution is to move it out of the package currently. I assume you wanted to keep it as a note for the future.

If you want to keep it in the package, you can create a tools directory and put it there.

Writing R Extensions says:

Subdirectory tools is the preferred place for auxiliary files needed during configuration, and also for sources need to re-create scripts (e.g. M4 files for autoconf: some prefer to put those in a subdirectory m4 of tools).

The tools directory is not installed, but it is included in the source package that you build with R CMD build. If you don't want to include it in the source package, add its path to the .Rbuildignore file.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.