[Rd] as-cran issue
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Mon Jan 13 18:02:08 CET 2020
On 13/01/2020 11:02 a.m., Therneau, Terry M., Ph.D. via R-devel wrote:
> Where can I find out (and replicate) what options as-cran turns on?
>
> The issue: the following lines generate an error in R CMD check --as-cran for coxme. But
> there is no error without as-cran nor is there one when I run the code in a terminal window.
>
> ismat <- function(x) inherits(x, "matrix") || inherits(x, "bdsmatrix") || inherits(x,
> "Matrix")
> if (ismat(kmat) ) ....
>
> (The second line is repeated multiple times for multiple arguments. The ismat function is
> defined simply to save typing.)
>
> The check log contains multiple instances of the lines below:
>
> < Warning message:
> < In if (ismat(kmat)) { :
> < the condition has length > 1 and only the first element will be used
>
> I don't see how the error could arise, but if I know what as-cran is doing perhaps I can
> replicate it.
>
> >sessionInfo()
> R Under development (unstable) (2020-01-13 r77659)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 18.04.3 LTS
>
> Matrix products: default
> BLAS: /usr/local/src/R-devel/lib/libRblas.so
> LAPACK: /usr/local/src/R-devel/lib/libRlapack.so
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> loaded via a namespace (and not attached):
> [1] compiler_4.0.0 tools_4.0.0
You have ismat() defined in two places in the package. In the
definition in coxme.R, you've got a typo:
ismat <- function (x) {
inherits(x, "matrix") || inherits(x, "bdsmatrix") | inherits(x,
"Matrix")
}
Notice the "|" instead of "||". I can't see how this would lead to the
issue you saw, but it should be fixed.
It's not easy to say what --as-cran does, other than to look at the
function that implements R CMD check. That function is the huge
tools:::.check_packages. You can run it in an R session using
options(warn = 2, error = recover)
tools:::.check_packages(c("--as-cran", "coxme_2.2-14.tar.gz"))
When I do that I get a different error report; it reports this test instead:
if(class(varlist) == "coxmevar")
That appears in a number of places in the coxme source, and clearly
needs to be updated to use inherits().
Duncan Murdoch
More information about the R-devel
mailing list