[R-pkg-devel] `Warning in formals(fun) : argument is not a function`

Mark Clements m@rk@c|ement@ @end|ng |rom k|@@e
Thu Jul 24 17:15:35 CEST 2025


I am looking for guidance on how to debug a CRAN warning for a package (rstpm2). The warning is:

`Warning in formals(fun) : argument is not a function`

I tried debugging this by using:

.onLoad <- function(libname, pkgname) {
    trace("formals", tracer = quote({
        cat(">>> formals called in R CMD check with object of class:", class(fun), "\n")
        print(sys.calls())
    }), print = FALSE)
}

At package installation, this showed that some formals() were called with objects of class derivedDefaultMethod -- however I am not certain _which_ objects cause this issue. (I realise that this suggests an issue with S3 versus S4 classes -- if that helps.) Does anyone have experience with debugging such warnings? Any guidance would be appreciated.

Sincerely, Mark.


När du skickar e-post till Karolinska Institutet (KI) innebär detta att KI kommer att behandla dina personuppgifter. Här finns information om hur KI behandlar personuppgifter<https://ki.se/om-ki/integritetsskyddspolicy>.


Sending email to Karolinska Institutet (KI) will result in KI processing your personal data. You can read more about KI’s processing of personal data here<https://staff.ki.se/data-protection-policy>.


More information about the R-package-devel mailing list