Edna Bell wrote:
Dear R Gurus:

What is the difference between a Primitive and a Generic, please?


They are talking about different things (though both look like functions): generic talks about the user interface, primitive talks about the internal implementation.

A generic is a function that will dispatch to a method, based on the class (or classes, in the case of S4) of what gets passed to it.

A primitive is a way to implement internal functions in R. You can write generic functions, but you need to modify the R source to write a primitive. Details of the primitive implementation are in the R Internals manual.

Duncan Murdoch

______________________________________________
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.

Reply via email to