Thanks a lot for your help - now it is fine!
BW
Troels
-----Oprindelig meddelelse-----
Fra: I?aki Ucar <iucar at fedoraproject.org>
Sendt: 11. januar 2019 18:37
Til: Troels Ring <tring at gvdnet.dk>
Emne: Re: [R-pkg-devel] NAMESPACE importFrom("stats", "uniroot")
See an example of usage here:
https://github.com/r-simmer/simmer/blob/f75e52fe1e71c7eda594f6cd41adbbed95b05c23/R/monitor-class.R#L124
And how this is processed by roxygen2 and added to the NAMESPACE automatically:
https://github.com/r-simmer/simmer/blob/956bb03ac355052c60e5341c0d16b0dc81ee736c/NAMESPACE#L181
I?aki
On Fri, 11 Jan 2019 at 18:30, Troels Ring <tring at gvdnet.dk> wrote:
Thanks a lot - I have added
@importFrom stats uniroot
And #' @importFrom stats uniroot in the NAMESPACE otherwise generated
by roxygen - I can't make it work - the first is not processed and the
next makes no difference apart from deleting the former NAMESPACE
file. I have tried adding the lines to the r file running uniroot - I
seem to be misunderstanding what goes on
Best wishes
Troels
-----Oprindelig meddelelse-----
Fra: I?aki Ucar <iucar at fedoraproject.org>
Sendt: 11. januar 2019 17:40
Til: Troels Ring <tring at gvdnet.dk>
Cc: package-develop <r-package-devel at r-project.org>
Emne: Re: [R-pkg-devel] NAMESPACE importFrom("stats", "uniroot")
On Fri, 11 Jan 2019 at 17:31, Troels Ring <tring at 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.h tml#imports If you don't use this function many many times, it is even better to use stats::uniroot instead. I?aki
-- I?aki ?car