-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Rolf Turner
Sent: Saturday, November 17, 2018 5:17 PM
To: r-help at r-project.org
Subject: [R] The Suggests field in a DESCRIPTION file.
I am building a package which contains a function from which I wish to call the
fortune() function from the fortunes package --- if that package is available.
I have place the line
Suggests: fortunes
in the DESCRIPTION file.
In my code for the function that I am writing (let's call it "foo") I put
fortOK <- requireNamespace(fortunes,quietly=TRUE)
if(fortOK) {
fortunes::fortune()
}
thinking that I was following all of the prescriptions in "Writing R Extensions".
Yet when I do R CMD check on the package I get
* checking R code for possible problems ... NOTE
foo: no visible binding for global variable ?fortunes?
Undefined global functions or variables:
fortunes
What am I doing wrong?
Thanks for any insight.
cheers,
Rolf Turner
P. S. I tried putting an "imports(fortunes)" in the NAMESPACE file, but this just
made matters worse:
* checking package dependencies ... ERROR Namespace dependency not
required: ?fortunes?
Huh? What on earth is this actually saying? I cannot parse this error
message.
R. T.
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276