[R-pkg-devel] package in 'Suggests'
Berry Boessenkool
berryboessenkool at hotmail.com
Wed Oct 19 21:29:04 CEST 2016
Hi,
A package I am developing will have one additional (not core) function depending on RCurl.
To keep dependencies low, I am considering to put RCurl in 'Suggests' instead of 'Imports'.
Also, I guess some users / systems may not have libcurl installed.
Then I would write something like
indexDWD <- function(...)
{
if(!requireNamespace("RCurl", quietly=TRUE))
stop("The R package 'RCurl' is not available. indexDWD can not obtain file list.\n",
"install.packages('RCurl') to enable this.")
... # otherwise do some nice stuff with RCurl::getURL
}
Can /should I still have an example tested by CRAN? (I've seen \dontrun used in similar situations)
Or should CRAN check never depend on an ftp-server being accessible?
A package in 'Suggests' with conditional usage via requireNamespace should be fine:
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Suggested-packages
Do you think it is advisable practice in this case?
Do you think my function should give a warning instead of an error and return an empty charstring or similar?
Thanks ahead for your ideas and thoughts!
Berry
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list