[R-pkg-devel] help with CRAN failures (broom.mixed, rstan-related)

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Wed Sep 25 18:21:20 CEST 2024


Hmm, so it's *not* a machine-specific problem after all [1,2] and can
now be reproduced on a regular R-devel build on Debian Sid. I'm sorry
for jumping to conclusions.

Why would Rcpp::loadModule() (called from rstan's .onLoad) end up trying
to apply a non-function, but only when being called from
broom.mixed/tests/testthat/test-alltibbles.R, and only on the first
attempt? (A repeated source() will run to completion without signalling
any errors.)

>> Error: package or namespace load failed for 'rstan' in
>> .doLoadActions(where, attach):
>> error in load action .__A__.1 for package rstan:
>> Rcpp::loadModule(module = "class_model_base", what = TRUE, env = ns,:
>> Unable to load module "class_model_base": attempt to apply
>> non-function
>> Error in .requirePackage(package) : unable to load required package
>> 'rstan'

The underlying error is in Rcpp::Module('class_model_base', mustStart =
TRUE, where = <namespace:rstan>):

>> simpleError in METHOD$info(""): attempt to apply non-function

This call originates in Rcpp:::method_wrapper:

Browse[3]> METHOD$info
NULL
Browse[3]> str(METHOD)
Prototypical reference class 'C++OverloadedMethods' [package "Rcpp"]
Browse[3]> unclass(METHOD) # print(METHOD) fails due do $info
<S4 Type Object>
attr(,".xData")
<environment: 0x5596b8ef1530>
Browse[3]> ls(METHOD using .xData, all = TRUE)
 [1] ".->class_pointer" ".->const"         ".->docstrings"    ".->nargs"
 [5] ".->pointer"       ".->signatures"    ".->size"          ".->void"
 [9] ".refClassDef"     ".self"            "class_pointer"    "const"
[13] "docstrings"       "nargs"            "pointer"        "signatures"
[17] "size"             "void"

Why would an object of reference class 'C++OverloadedMethods' suddenly
lose its $info method? This doesn't look like anything printed when I
trace(Rcpp:::method_wrapper, quote(print(METHOD))) and then load
'rstan' in a fresh R session.

-- 
Best regards,
Ivan

[1]
https://cran.r-project.org/web/checks/check_results_broom.mixed.html

[2]
https://www.stats.ox.ac.uk/pub/bdr/donttest/broom.mixed.out



More information about the R-package-devel mailing list