[R] The Suggests field in a DESCRIPTION file.

Rolf Turner r@turner @ending from @uckl@nd@@c@nz
Sat Nov 17 23:16:46 CET 2018


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



More information about the R-help mailing list