Skip to content
Prev 116323 / 398498 Next

Please, remind a function name

You could use the class dispatching mechanism:


mymodel <- function(a, b, method = "S") {
	.Class <- method
	NextMethod("mymodel")
}

mymodel.S <- function(a, b, method = "S") cat("S:", a, b, method, "\n")
mymodel.HK <- function(a, b, method = "S") cat("HK:", a, b, method, "\n")

mymodel(1:3, 1:4)
mymodel(1:3, 1:4, "S")
mymodel(1:3, 1:4, "HK")
On 5/22/07, Vladimir Eremeev <wl2776 at gmail.com> wrote: