[R-pkg-devel] Confusion about what should be in Imports for a package with a shiny app
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Wed Mar 24 08:31:45 CET 2021
On 24/03/2021 12:16 a.m., R. Mark Sharp wrote:
> I have a package (nprcgenekeepr) in which some packages listed in the DESCRIPTION file are used only within the shiny app scripts. For my prior CRAN submission (successful), I placed such packages in the Suggests section of the DESCRIPTION file. This time testing sites seemed to have directed me to place them in the Imports section and I now have multiple test environments (3 R-hub builder, 3 winbuilder, and 3 Travis-ci) that are showing no errors, warnings, or notes with that placement. However, the package check page https://cran.rstudio.com//web/checks/check_results_nprcgenekeepr.html site is showing the wrong package version (1.0.3 instead of 1.0.5) and some environments with a note of "Namespace in Imports field not imported from: ‘shinyBS’ All declared Imports should be used.”
>
> I changed the function call from `popify` to `shinyBS::popify` and get the same results
>
> I moved shinyBS to Suggests and I get the same note.
>
> I also have shinyWidgets used within the same UI script and listed in the Imports section and it does not generate a note.
>
> It appears that I have a basic misunderstanding of the message in the note and of where the `shinyBS` package should be listed within the DESCRIPTION file.
>
> Help will be appreciated.
>
The check code won't examine R code in your inst/application directory
where the Shiny app code is kept, so that's why you get the "All
declared Imports should be used" message.
Your README says
"The goal of nprcgenekeepr is to implement Genetic Tools for Colony
Management. It was initially conceived and developed as a Shiny web
application at the Oregon National Primate Research Center (ONPRC) to
facilitate some of the analyses they perform regularly. It has been
enhanced to have more capability as a Shiny application and to expose
the functions so they can be used either interactively or in R scripts."
This indicates that you expect some users aren't going to use the Shiny
script, so they won't need shinyBS. That means it should be in
Suggests, not Imports, and your Shiny app should check whether it is
available before trying to run it.
If you think *most* users will want the Shiny app, then you could force
it to be installed and loaded by putting it in Imports. Then you'll
have to make use of it somewhere in your main code to silence the
message. But it's probably better to leave it in Suggests.
As to the "wrong package version" issue: CRAN isn't showing 1.0.5
anywhere. You may have submitted it, but it hasn't been accepted. It's
not in the CRAN queues, so you'll need to submit again if you want it on
CRAN.
Duncan Murdoch
More information about the R-package-devel
mailing list