[R] The Suggests field in a DESCRIPTION file.

Fox, John jfox @ending from mcm@@ter@c@
Sat Nov 17 23:22:32 CET 2018


Dear Rolf,

"fortunes" needs to be quoted in requireNamespace("fortunes", quietly=TRUE).

I hope this helps,
 John

-----------------------------------------------------------------
John Fox
Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
Web: https://socialsciences.mcmaster.ca/jfox/



> -----Original Message-----
> From: R-help [mailto:r-help-bounces using r-project.org] On Behalf Of Rolf Turner
> Sent: Saturday, November 17, 2018 5:17 PM
> To: r-help using 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
> 
> ______________________________________________
> R-help using 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.


More information about the R-help mailing list