[R-pkg-devel] Package submission fail

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Mon Nov 13 14:46:58 CET 2023


Hello Christiaan and welcome to R-package-devel!

В Fri, 10 Nov 2023 20:35:49 +0200
Christiaan Pieterse <pietie.cjp.1908 using gmail.com> пишет:

> Check: CRAN incoming feasibility, Result: NOTE
>   Maintainer: 'C.J Pieterse <pietie.cjp.1908 using gmail.com>'
> 
>   New submission

This one is to be expected for a first submission.

>   Size of tarball: 10537094 bytes

I highly recommend to find a way to replace the 50-megabyte
inst/extdata/ExampleTradeData.csv with a smaller file. CRAN policy [*]
says "As a general rule, neither data nor documentation should exceed
5MB", and your package tarball mostly consists of example data.

> Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-x86_64
> Check: Rd files, Result: NOTE
>   checkRd: (-1) IOPS.Rd:17: Escaped LaTeX specials: \_ \_
>   checkRd: (-1) IOPS.Rd:36: Escaped LaTeX specials: \_
>   checkRd: (-1) IOPS.Rd:42: Escaped LaTeX specials: \_
>   checkRd: (-1) IOPS.Rd:44: Escaped LaTeX specials: \_
>   checkRd: (-1) IOPS.Rd:46: Escaped LaTeX specials: \_
>   checkRd: (-1) IOPS.Rd:48: Escaped LaTeX specials: \_ \_
>   checkRd: (-1) IOPS.Rd:50: Escaped LaTeX specials: \_

Not sure why roxygen2 is generating these for you. Maybe you need to
update roxygen2 to a newer version that doesn't generate
country\_codes\_V202201 from country_codes_V202201 and run roxygenise()
again. Duncan's idea to encode these as \code{} (or maybe \verb{} if
it's not intended to be R code) is also good.

> Check: examples, Result: NOTE
>   Examples with CPU (user + system) or elapsed time > 5s
>          user system elapsed
>   IOPS 170.57  2.971 173.549

CRAN policy says: "Checking the package should take as little CPU time
as possible". Once you make a smaller example file, it will probably be
also faster to process.

The examples in the help pages are not only for R CMD check to run and
for CRAN to complain about; they are also present in the package for
the user to run example(IOPS) and see it in action. As a user, I would
probably get bored and interrupt your example if it takes more than 2
minutes to run.
 
> Check: for non-standard things in the check directory, Result: NOTE
>   Found the following files/directories:
>     'Combined_Results.csv' 'Combined_Results.xlsx'

"Packages should not write <...> anywhere <...> on the file system apart
from the R session’s temporary directory"

As a user, I would prefer example(IOPS) to modify as little of my
environment as possible. If I had valuable data saved as
"Combined_Results.csv" in the current directory, example(IOPS) would
have overwritten this file. As already pointed out by Duncan Murdoch,
the example will have to create its files under tempdir() and remove
them after it's done.

These are not the only problems you need to fix. Currently, your code
begins by loading a number of packages:

> #requireNamespace("roxygen2")
> requireNamespace("Rcpp")
> requireNamespace("dplyr")
> requireNamespace("tidyr")
> #requireNamespace("readxl")
> requireNamespace("economiccomplexity")
> requireNamespace("usethis")
> requireNamespace("Matrix")
> requireNamespace("tibble")
> requireNamespace("openxlsx")
> requireNamespace("utils")
> #requireNamespace("stats")
> 
> library("Rcpp")
> library("tidyr")
> library("dplyr")
> library("readxl")
> library("economiccomplexity")
> library("usethis")
> library("roxygen2")
> library("openxlsx")
This doesn't play well with the package dependency mechanism. You
should specify which functions you export, import individual functions
or whole packages in the NAMESPACE file [**]. Since you're using
roxygen2, you can use the @importFrom tag to declare your dependencies,
and it will generate the NAMESPACE file for you. Packages shouldn't be
calling library(), and for any optional dependencies, the return value
of requireNamespace() should be checked.

> if( ComplexMethod == "reflections"&& ComplexMethod == "eigenvalues" &&
> ComplexMethod == "fitness") stop('Invalid complexity method')
You probably meant to say !(condition || condition || condition)
instead of condition && condition && condition here. You can also use
the built-in R function stopifnot() as a shorthand for validating
various conditions. switch() with a default stop() and/or match.args()
is also an option.

> CorrectCountryNr <- readline("Please enter correct country
> (corresponding integer): ")
You will probably want to condition this on interactive() and transform
this into an error when the R session is running in batch mode,
unattended. There is not enough error checking after readline() (what
if the user makes a typo?). The menu() function can do most of this for
you.

Good luck, and I hope your next version of the package gets accepted!

-- 
Best regards,
Ivan

[*] https://cran.r-project.org/web/packages/policies.html

[**]
https://cran.r-project.org/doc/manuals/R-exts.html#Specifying-imports-and-exports



More information about the R-package-devel mailing list