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
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.