Include a file
dependencies.R with your application or document and include
library(dependency) for each package dependency. That file is not loaded by your content, but its presence in the deployment is enough for
packrat to list those packages as required.
packrat package is responsible for identifying dependencies within your content; it does not know about the
import package or how it adds packages.
It looks like someone recently filed an issue against
packrat asking for
import support: https://github.com/rstudio/packrat/issues/527
identifyPackagesUsed is where most code scanning occurs. It would need to know about the ways that
import adds package dependencies. https://github.com/rstudio/packrat/blob/505f12aa4ef884cc7021719f4f0e4b69a0b93354/R/dependencies.R#L401
Until the reference
packrat issue is solved, the
dependencies.R option is the most straightforward way to get your dependencies correctly enumerated. Unfortunately, it means declaring those references in two places.