The usual way of adding dependencies to an R package is to add the packages in the Imports
Field of the DESCRIPTION
file. Here is an adaped version from Hadley Wickam's introduction.
Package: mypackage
Title: What The Package Does (one line, title case required)
Version: 0.1
Authors@R: person("First", "Last", email = "first.last@example.com",
role = c("aut", "cre"))
Description: What the package does (one paragraph)
Depends: R (>= 3.1.0), shiny
Imports: shinyBS
License: What license is it under?
LazyData: true
Then you will need to specify which functions from the shinyBS
package are actually needed in the package with importsFrom
in the NAMESPACE
file. Alternatively, you can also import all shinyBS
functions with
import(shinyBS)
However, in the case of shinyBS
, you will actually need to put the dependency in the Depends
field because of the way the onLoad/onAttach
hooks are defined for that package. For more dertails, see here. Your DESCRIPTION
file should therefore look like the following example
Package: mypackage
Title: What The Package Does (one line, title case required)
Version: 0.1
Authors@R: person("First", "Last", email = "first.last@example.com",
role = c("aut", "cre"))
Description: What the package does (one paragraph)
Depends: R (>= 3.1.0), shiny, shinyBS
License: What license is it under?
LazyData: true
This is quite unusual and in my opinion, this issue should be fixed from the shinyBS
developers. However, in the mean time using the Depends
field to make sure shinyBS
is attached is a viable workaround for the issue you described.