[R] dots in function names

Gabor Grothendieck ggrothendieck at myway.com
Wed Mar 24 01:35:13 CET 2004



Typing 

> plot

shows the source which shows that plot uses UseMethod -- thus
its an S3 generic.  Knowing that, issuing:

> methods(plot)

gives a list of methods.

Date:   Tue, 23 Mar 2004 18:07:45 -0600 
From:   Robert W. Baer, Ph.D. <rbaer at atsu.edu>
To:   <r-help at stat.math.ethz.ch> 
Cc:   Paul Murrell <p.murrell at auckland.ac.nz> 
Subject:   [R] dots in function names 

 
In a (off-list) response to a question of frequency polygons, Dr Paul
Murrell writes:
> There's an "ann" arg which you can use to turn off the default labels
> (ann=FALSE). Have you seen help(plot.default) as well as help(plot)?

Thank you again, Paul. Interestingly, the ?plot help contains no mention of
the 'ann' parameter. In fact, I have been guessing about what parameters
are legal in plot() or using examples from various R tutorials because ?plot
help just enumerates them with as ... after x and y. I did not know that
plot.default existed although I now find it in response to a
help.search("plot"). This search produces many plot.something() functions.
I knew nothing about any of these "other" plot functions.

There has been mention of S3 objects on the list. Is this relevant here?
Is 'plot.default' a method (or perhaps a type-dependent object
instantiation?) of the "plot function" object, or is 'plot.default' just a
second function object that shares a part of a name and uses a "convenience"
dot for readability? Does R have standard naming conventions in this
regard? I'm guessing that 'plot.default' is a method? of 'plot'. Assuming
that other 'plot.something' functions are methods or instantiations of a
main 'plot' function object, how do I learn more about such a "main"
object's subparts short of studying code? The ?plot help document does not
have a "see also" for plot.default or (many) other 'plot.something'
functions. Is there a simple way to troll for such things when trying to
expand your horizons?

Any general hints on how one should approach the self-education process in
this type of situation?

Thanks,
Rob Baer




More information about the R-help mailing list