Re: [R] the difference between UseMethod and NextMehod?

From: Gabor Grothendieck <ggrothendieck_at_myway.com>
Date: Mon 11 Apr 2005 - 12:34:42 EST

ronggui <0034058 <at> fudan.edu.cn> writes:

: hi,usRs,i am studing the R programming,but i can not get the point abut the
difference between UseMethod
: and NextMehod.i have read the manual and try to find the solutin from
internet,but i still not master it
: well.so anyone can give me a guide?it will be better to show some examples .

One normally uses UseMethod within a generic function to dispatch the appropriate method while NextMethod is normally used within the function so dispatched.

An important difference is that UseMethod does not return, i.e. statements after UseMethod are not evaluated, whereas NextMethod does return.

Have a look at print and print.ts for examples of UseMethod and NextMethod, respectively. Just type the following at the R prompt:

print
print.ts



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Apr 11 12:46:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:06 EST