the code below has me confused: setClassUnion("index", c("numeric", "character", "logical")) extends("numeric") # i don't see the class union library(Matrix) extends("numeric") # now i see the class union
i am aware that the "Matrix" package separately defines the "index" class union. is it the case that class definitions need to occur in packages? i am also having trouble dispatching on class unions defined in the global environment, which may just be the same problem. see code below: setClassUnion("numORchar", c("numeric", "character")) foo <- function(x) "Default" setMethod("foo", signature(x = "numORchar"), function(x) "numORchar") foo(2) # gives the default method franklin > version _ platform powerpc-apple-darwin8.7.0 arch powerpc os darwin8.7.0 system powerpc, darwin8.7.0 status major 2 minor 4.0 year 2006 month 10 day 03 svn rev 39566 language R version.string R version 2.4.0 (2006-10-03) ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel