S Programming by Venables and Ripley (page 78) has the example listed at the end of this email. However, I get the following error when I try the example. I don't understand the descriptions of NextMethod on its help page. Could somebody let me know how to fix the error of this example?
> test(x) c1 c2 Error in NextMethod() : no method to invoke Calls: test -> test.c1 -> NextMethod -> test.c2 -> NextMethod Execution halted #### test=function(x) UseMethod('test') test.c1=function(x) { cat('c1\n') NextMethod() x } test.c2=function(x) { cat('c2\n') NextMethod() x } test.c3=function(x) { cat('c3\n') x } x=1 class(x)=c('c1','c2') test(x) ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.