Skip to content
Prev 63421 / 63424 Next

Should as() find an ANY method even for an 'unregistered' S3 class?

OK, here is a self-contained version

setClass("integer64")
setAs("ANY", "integer64", function(from) {
  structure(from, class = "integer64")
})
x <- 1e10
class(x) <- c("foo", "integer64")
as(x, "integer64")
# Error in as(x, "integer64") :
#   internal problem in as(): ?foo? is(object, "integer64") is TRUE, but
the metadata asserts that the 'is' relation is FALSE

Mike C

On Thu, Mar 19, 2026 at 2:11?AM Martin Maechler <maechler at stat.math.ethz.ch>
wrote: