[Rd] Recommended way to call/import functions from a Suggested package

Hadley Wickham h.wickham at gmail.com
Mon Feb 25 22:28:05 CET 2013

> To summarize, it appears that the only way to call functions from a
> suggested package is by using either 'require' (which will dynamically
> attach it) or the double colon method. Is this something that should be
> mentioned in R-exts?

Except the double colon method doesn't work (i.e. does not pass R CMD
check) unless you also import the package, which means it's no longer
just a suggestion - it must always be installed.

A simple test case (attached DESCRIPTION and R/test.r) yields this
warning on R CMD check:

* checking for unstated dependencies in R code ... WARNING
'::' or ':::' import not declared from: 'MASS'
See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.


Chief Scientist, RStudio

More information about the R-devel mailing list