Skip to content
Prev 2872 / 12125 Next

[R-pkg-devel] Weird error on CRAN linux check

Wow, this is extremely helpful. I've applied Joris' patch. By the way, the
github master has the change that I stopped exporting methods, as per
Hadley's suggestion; this caused *all* functions created via
make_getter_setters to fail. Version 4.0.1 on CRAN has the methods
exported, which was masking the error in most cases. I don't know why
bold() was failing in certain cases only... in any case, the patch seems to
fix things.

Here is a brief test case that shows the original problem. I don't know
whether this reveals any problem in base R:

# in package mypackage:
#' @export
foo <- function (x, ...) UseMethod('foo')
make_a_method <- function () assign("foo.bar", function (x, ...) cat("In
foo.bar"), pos = getNamespace('mypackage'))
make_a_method()

# in the console:
library(mypackage)
mypackage:::foo.bar
## function (x, ...) cat("In foo.bar")
## <bytecode: 0x109a0ab80>
## <environment: 0x109a0ba28>
x <- structure(1, class='bar')
foo(x)
## Error in UseMethod("foo") :
##  no applicable method for 'foo' applied to an object of class "bar"

Also, I know I shouldn't be using @s3method ... it's on the TODO list... !

Cheers,
David
On Thu, 5 Jul 2018 at 09:07, I?aki ?car <i.ucar86 at gmail.com> wrote: