[R-pkg-devel] NAMESPACE importFrom("stats", "uniroot")

Iñaki Ucar iuc@r @ending from fedor@project@org
Fri Jan 11 17:40:24 CET 2019


On Fri, 11 Jan 2019 at 17:31, Troels Ring <tring using gvdnet.dk> wrote:
>
> Dear friends - I'm slowly learning to make packages in RStudio and it seems
> impressive. I managed now to have my acidbase package pass the check-package
> test with this result
>
>
>
> > checking R code for possible problems ... NOTE
>
>   pH_general: no visible global function definition for 'uniroot'
>
>   Undefined global functions or variables:
>
>     uniroot
>
>   Consider adding
>
>     importFrom("stats", "uniroot")
>
>   to your NAMESPACE file.
>
>
>
> 0 errors v | 0 warnings v | 1 note x
>
>
>
> R CMD check succeeded
>
>
>
> So I have much use of uniroot in the package but get this "note" above and a
> suggestion to augment the NAMESPACE file - so even though it was issuing : #
> Generated by roxygen2: do not edit by hand
>
> I of course tried adding by hand - and in the next run the NAMESPACE file
> was quite empty and without any exports and the added import while before it
> exported a number of functions. So I deleted this unwelcome NAMESPACE and
> got the old one back.
>
> I also tried adding importFrom("stats", "uniroot") as #'
> @importFrom("stats", "uniroot") to the r file with the routine using uniroot
> but that didn't change the NAMESPACE or remove the note when checking. It
> may be no big problem - but I'd like to see no notes or warnings

The syntax is "@importFrom stats uniroot". See roxygen2's docs:

https://cran.r-project.org/web/packages/roxygen2/vignettes/namespace.html#imports

If you don't use this function many many times, it is even better to
use stats::uniroot instead.

Iñaki



More information about the R-package-devel mailing list