Not sure what's going on here, and I have been unable to produce a MVE. This only happened to me with the units package. This is a (not minimal) reproducible example:
$ git clone https://github.com/r-quantities/units.git && cd units
$ R
> iris.u <- iris
> iris.u[1:4] <- lapply(iris.u[1:4], function(x) units::set_units(x, cm))
> plot(Sepal.Length ~ Sepal.Width, iris.u) # plot with units, all ok
> pkgload::load_all()
> plot(Sepal.Length ~ Sepal.Width, iris.u)
Error in NextMethod("plot", xlab = xlab, ylab = ylab) :
no method to invoke
Somehow load_all messes up S3 dispatch. Given that this is called by devtools::test in RStudio, I'm basically unable to test formula-based plots there.
> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora Linux 35 (Thirty Five)
Matrix products: default
BLAS/LAPACK: /usr/lib64/libflexiblas.so.3.1
locale:
[1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=es_ES.UTF-8
[5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=es_ES.UTF-8
[7] LC_PAPER=es_ES.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] units_0.8-0 testthat_3.1.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8 prettyunits_1.1.1 ps_1.6.0 crayon_1.4.2
[5] withr_2.4.3 rprojroot_2.0.2 brio_1.1.3 R6_2.5.1
[9] magrittr_2.0.1 rlang_0.4.12 cli_3.1.1 callr_3.7.0
[13] desc_1.4.0 tools_4.1.2 glue_1.5.1 processx_3.5.2
[17] pkgload_1.2.4 compiler_4.1.2 pkgbuild_1.3.0 CoprManager_0.3.9
Not sure what's going on here, and I have been unable to produce a MVE. This only happened to me with the
unitspackage. This is a (not minimal) reproducible example:Somehow
load_allmesses up S3 dispatch. Given that this is called bydevtools::testin RStudio, I'm basically unable to test formula-based plots there.