[R-pkg-devel] `Warning in formals(fun) : argument is not a function`
Mark Clements
m@rk@c|ement@ @end|ng |rom k|@@e
Fri Jul 25 16:39:36 CEST 2025
Ivan: thank you for your reply.
I have now resolved this issue. I had an error with specifying an S4 implementation and its documentation. For debugging, I: (a) checked that a previous package version worked with a recent R development version; (b) used tools::codoc() to check the documentation (see the test-codoc task in $(RSRC)/tests/Makefile.common), using Ivan's suggested options() to recover from a warning; and (c) checked whether the S4 class had the available method.
Sincerely, Mark.
________________________________
From: Ivan Krylov <ikrylov using disroot.org>
Sent: 24 July 2025 22:07
To: Mark Clements <mark.clements using ki.se>
Cc: r-package-devel using r-project.org <r-package-devel using r-project.org>
Subject: Re: [R-pkg-devel] `Warning in formals(fun) : argument is not a function`
� Thu, 24 Jul 2025 15:15:35 +0000
Mark Clements <mark.clements using ki.se> �����:
> 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`
Could you please provide some more information on where you encounter
it and how it may be reproduced? I don't see it mentioned at
<https://cran.r-project.org/web/checks/check_results_rstpm2.html<https://cran.r-project.org/web/checks/check_results_rstpm2.html>>, nor
I see a recent incoming_pretest failure, but I do see some problems
regarding constants being overwritten at
<https://github.com/kalibera/cran-checks/tree/master/rcnst/results/rstpm2<https://github.com/kalibera/cran-checks/tree/master/rcnst/results/rstpm2>>.
It's not impossible that the root cause of this warning is the same
(although it's also plausible that it's different).
> 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 think this is a red herring: a derivedDefaultMethod is a function and
doesn't cause this warning by itself:
getClass('derivedDefaultMethod') |> new(\(foo=bar) baz) |> formals()
# $foo
# bar
> Does anyone have experience with debugging such warnings?
If you can reproduce the warning, try doing so with options(warn = 2,
error = recover) set.
--
Best regards,
Ivan
Nar du skickar e-post till Karolinska Institutet (KI) innebar detta att KI kommer att behandla dina personuppgifter. Har 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>.
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list