Skip to content
Prev 22153 / 63424 Next

S3 methods for cbind/rbind

Maybe you could use rbind2, which has an S4 generic in the methods
package, instead?

# BOD is a data frame built into R
foo <- structure(BOD, class = c("bar", "data.frame"))
setOldClass("bar")
setMethod("rbind2", signature(x = "bar", y = "bar"),
	  function(x, y) {
		cat("Hello!\n")
		class(x) <- class(y) <- "data.frame"
		rbind(x, y)
	})

# test
foo <- structure(BOD, class = c("bar", "data.frame"))
rbind2(foo, foo)
On 9/27/06, Vincent Goulet <vincent.goulet at act.ulaval.ca> wrote: