[R-pkg-devel] correcting errors in an existing package

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Sat Apr 1 23:34:08 CEST 2023


On 31/03/2023 4:51 p.m., Dennis Boos wrote:
> Recently I got a message from CRAN that my package Monte.Carlo.se (on CRAN
> for the last few years) does not pass current testing.  There seemed to be
> 2 problems:
> 
> ***************************************************************************************************************
> 
> 1. * checking LazyData ... NOTE
>    'LazyData' is specified without a 'data' directory
> 
> I have this line in my DESCRIPTION file:
> 
> LazyData: true
> 
> Should I remove that?
> 
> *****************************************************************************************************************
> 
> 2. * checking examples with --run-donttest ... [42s/42s] ERROR
> Running examples in ‘Monte.Carlo.se-Ex.R’ failed
> The error most likely occurred in:
> 
>> pairwise.se(hold,xcol=10:12,summary.f=cv)
> Error: object 'hold' not found
> Execution halted
> 
> ***************************************************************************************
> 
> So, I put in the R code to generate the data matrix *hold.  *But that
> brought a host of other errors when checking in Rstudio with
> 
>> devtools::check("S:/Documents/srcis/a.projects/Monte.Carlo.isr.and.package/Monte.Carlo.se.March.2023")
> 
> I started seeing the following list about standard functions like sd.
> 
> N  checking R code for possible problems (3.4s)
>     boot.se: no visible global function definition for 'sd'
>     boot.var: no visible global function definition for 'var'
>     corr: no visible global function definition for 'cor'
>     cv: no visible global function definition for 'sd'
>     ratio.mean.sdhat.sd: no visible global function definition for 'sd'
>     ratio.mean.vhat.var: no visible global function definition for 'var'
>     ratio.sd: no visible global function definition for 'sd'
>     ratio.var: no visible global function definition for 'var'
>     varn: no visible global function definition for 'var'
>     Undefined global functions or variables:
>       cor sd var
>     Consider adding
>       importFrom("stats", "cor", "sd", "var")
>     to your NAMESPACE file.
> 
> But you can't add those functions to NAMESPACE. Well I did but
> 
> devtools::build()
> 
> 
> gets rid of it. Also, I keep getting the message in the Rstudio check
> 
> WARNING
>     'qpdf' is needed for checks on size reduction of PDFs
> 
> 
> but I got the latest versions of R and Rstudio and was able to get
> qpdf to install and loaded with library(qpdf), but Rstudio still gives
> that message.
> 

It sounds as though you're using Roxygen2 to generate your NAMESPACE 
file.  If so, you need @imports directives in the comments 
(conventionally before the function that uses the import, but I think it 
doesn't really matter where).

Duncan Murdoch



More information about the R-package-devel mailing list