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

Dennis Boos boo@ @end|ng |rom nc@u@edu
Tue Apr 4 15:41:41 CEST 2023


Thanks so much to all of you.  If you have time, I'm getting really
contradictory results.

1. It first seemed to have passed the check in Rstudio (I used
device::build() in the R window and then clicked on check in the drop down
menu under build).

==> devtools::check(document = FALSE, args = c('--as-cran'))
── R CMD check results  Monte.Carlo.se 0.1.1 ────
Duration: 56.6s
0 errors ✔ | 0 warnings ✔ | 0 notes ✔

R CMD check succeeded

However, I then couldn't find the tar.gz where it was supposed to be. It
was just gone.


Here is my namespace.  It says not to edit, but I had been told to add
the importFrom. So I didn't use
devtools::document() for fear roxygen2 would get rid of it.

# Generated by roxygen2: do not edit by hand
importFrom("stats", "cor", "sd", "var")
export(boot.se)
export(jack.se)
export(mc.se.matrix)
export(mc.se.vector)
export(pairwise.se)
export(sim.samp)

4. Here is my DESCRIPTION file

Package: Monte.Carlo.se
Type: Package
Title: Monte Carlo Standard Errors
Version: 0.1.1
Author: Dennis Boos, Kevin Matthew, Jason Osborne
Maintainer: Dennis Boos <boos using ncsu.edu>
Description: Computes Monte Carlo standard errors for summaries of
Monte Carlo output. Summaries and their standard errors are based on
columns of Monte Carlo simulation output. Dennis D. Boos and Jason A.
Osborne (2015) <doi:10.1111/insr.12087>.
License: GPL-3
Encoding: UTF-8
RoxygenNote: 7.2.3
Suggests: knitr, rmarkdown
Imports: stats
VignetteBuilder: knitr

5. And because of your advice: " It sounds as though you're using
Roxygen2 to generate your NAMESPACE file.
ff 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)."

So I put "@imports" in the function that had trouble

#' @examples
#' \donttest{
#' # Using the output data matrix hold generated in vignette Example3,
#' # calculate jackknife and bootstrap standard errors
#' # for the differences and ratios of the CV estimates.
#' # First get the components of hold needed.
#'
#' @imports
#'
#' trim20 <- function(x){mean(x,.2)} # 20% trimmed mean function

Was that the correct thing to do?

6. And here are the failed check results. I'm clueless at this point.

==> devtools::check(document = FALSE, args = c('--as-cran'))
══ Building ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════Setting
env vars:
• CFLAGS    : -Wall -pedantic -fdiagnostics-color=always
• CXXFLAGS  : -Wall -pedantic -fdiagnostics-color=always
• CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX14FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX17FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX20FLAGS: -Wall -pedantic -fdiagnostics-color=always── R CMD build
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────✔
 checking for file 'C:\Users\boos\Dropbox\My PC
(boos-home)\Desktop\dennis\R.packages\Monte.Carlo.se.March.2023/DESCRIPTION'
...─  preparing 'Monte.Carlo.se':✔  checking DESCRIPTION
meta-information ...─  installing the package to build vignettes✔
creating vignettes (3.6s)─  checking for LF line-endings in source and
make files and shell scripts─  checking for empty or unneeded
directories─  building 'Monte.Carlo.se_0.1.1.tar.gz'
   ══ Checking ════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════Setting
env vars:
• _R_CHECK_CRAN_INCOMING_REMOTE_               : FALSE
• _R_CHECK_CRAN_INCOMING_                      : FALSE
• _R_CHECK_FORCE_SUGGESTS_                     : FALSE
• _R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_: FALSE
• NOT_CRAN                                     : true── R CMD check
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 using log directory 'C:/Users/boos/Dropbox/My PC
(boos-home)/Desktop/dennis/R.packages/Monte.Carlo.se.Rcheck' (793ms)─
using R version 4.2.3 (2023-03-15 ucrt)─  using platform:
x86_64-w64-mingw32 (64-bit)─  using session charset: UTF-8─  using
options '--no-manual --as-cran' (653ms)✔  checking for file
'Monte.Carlo.se/DESCRIPTION'─  checking extension type ... Package─
this is package 'Monte.Carlo.se' version '0.1.1'─  package encoding:
UTF-8✔  checking package namespace information✔  checking package
dependencies (3.2s)✔  checking if this is a source package✔  checking
if there is a namespace✔  checking for executable files (491ms)✔
checking for hidden files and directories ...✔  checking for portable
file names✔  checking serialization versions✔  checking whether
package 'Monte.Carlo.se' can be installed (2.9s)✔  checking installed
package size ... ✔  checking package directory ...✔  checking for
future file timestamps ... ✔  checking 'build' directory✔  checking
DESCRIPTION meta-information ... ✔  checking top-level files ...✔
checking for left-over files✔  checking index information ... ✔
checking package subdirectories ... ✔  checking R files for non-ASCII
characters ... ✔  checking R files for syntax errors ... ✔  checking
whether the package can be loaded ... ✔  checking whether the package
can be loaded with stated dependencies ... ✔  checking whether the
package can be unloaded cleanly ... ✔  checking whether the namespace
can be loaded with stated dependencies ... ✔  checking whether the
namespace can be unloaded cleanly ... ✔  checking loading without
being on the library search path ... N  checking dependencies in R
code ...
   Namespace in Imports field not imported from: 'stats'
     All declared Imports should be used.✔  checking S3 generic/method
consistency (422ms)✔  checking replacement functions ... ✔  checking
foreign function calls ... N  checking R code for possible problems
(3s)
   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.✔  checking Rd files ... ✔  checking Rd
metadata ... ✔  checking Rd line widths ... ✔  checking Rd
cross-references ... ✔  checking for missing documentation entries ...
✔  checking for code/documentation mismatches (562ms)✔  checking Rd
\usage sections (661ms)✔  checking Rd contents ... ✔  checking for
unstated dependencies in examples ... ✔  checking installed files from
'inst/doc'W  checking files in 'vignettes' ...
   Files in the 'vignettes' directory newer than same file in 'inst/doc':
     'Brief-Overview.Rmd'✔  checking examples (573ms)─  checking
examples with --run-donttest ... [24s] OK (24.7s)✔  checking for
unstated dependencies in vignettes ... ✔  checking package vignettes
in 'inst/doc' ...✔  checking re-building of vignette outputs (6.8s)✔
checking for non-standard things in the check directory ...✔  checking
for detritus in the temp directory

   See
     'C:/Users/boos/Dropbox/My PC
(boos-home)/Desktop/dennis/R.packages/Monte.Carlo.se.Rcheck/00check.log'
   for details.

   ── R CMD check results
───────────────────────────────────────────────────────────────────────────────────
Monte.Carlo.se 0.1.1 ────
Duration: 51.5s
❯ checking files in 'vignettes' ... WARNING
  Files in the 'vignettes' directory newer than same file in 'inst/doc':
    'Brief-Overview.Rmd'
❯ checking dependencies in R code ... NOTE
  Namespace in Imports field not imported from: 'stats'
    All declared Imports should be used.
❯ checking R code for possible problems ... NOTE
  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.
0 errors ✔ | 1 warning ✖ | 2 notes ✖
Error: R CMD check found WARNINGs
Execution halted

Exited with status 1.





On Sat, Apr 1, 2023 at 5:34 PM Duncan Murdoch <murdoch.duncan using gmail.com>
wrote:

> 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
>
>

-- 
Dennis Boos                      email: dennis_boos using ncsu.edu
Department of Statistics    Phone: 919-515-1918
NC State University           Fax: 919-515-1169
Raleigh, NC 27695-8203   http://www4.stat.ncsu.edu/~boos

Aim for kindness, tolerance, and humility.

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list