----------------------------------------------------------
How can I see the code behind the function. For example,
> boxplot
function (x, ...)
UseMethod("boxplot")
<environment: namespace:graphics>
I really would like to see how people code this.
----------------------------------------------------------
That *is* the code. "boxplot" is a generic function, which calls another
function based on what class of object you pass to it. You can find out which
classes the boxplot method works on by using
> methods("boxplot")
[1] boxplot.default boxplot.formula*
Non-visible functions are asterisked
Next, try typing
> boxplot.default
to see the implementation for the default function, and then since
boxplot.formula is hidden, usually
getAnywhere("boxplot.formula")
will retrieve it.
Section 10.9 of An Introduction to R explains this more:
http://cran.r-project.org/doc/manuals/R-intro.html#Object-orientation
Best Regards,
Erik Iverson
______________________________________________
[email protected] 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.