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 . thank you !
Prof Brian Ripley
2005-Apr-10 17:00 UTC
[R] the difference between UseMethod and NextMehod?
See `S Programming' (see the FAQ) and the White Book (see the FAQ), since you say you have already read the `R Language Definition' (`the manual'). You can grep the R sources for examples. On Sun, 10 Apr 2005, ronggui wrote:> 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 .-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Gabor Grothendieck
2005-Apr-11 02:34 UTC
[R] the difference between UseMethod and NextMehod?
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