[R] variable names when using S3 methods

From: Aaron Rendahl <arendahl_at_stat.umn.edu>
Date: Mon, 28 Apr 2008 06:49:31 -0500

I'm seeing some funny behavior when using methods (the older S3 type) and having variables that start with the same letter. I have a vague recollection of reading something about this once but now can't seem to find anything in the documentation. Any explanation, or a link to the proper documentation, if it does exist, would be appreciated.

Thanks, Aaron Rendahl
University of Minnesota School of Statistics

# set up two function that both use method "foo" but with different
variable names



# now set up two methods (default and character) that have an
additional variable
foo.character <- function(model, m=5,...)

        cat("foo.character: m is", m, "\n")
foo.default <- function(model, m=5,...)

        cat("foo.default: m is", m, "\n")

# both of these use foo.character, as expected

# but here, fooA uses foo.default instead

# additionally, these use foo.character, as expected

R-help_at_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. Received on Mon 28 Apr 2008 - 11:57:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 Apr 2008 - 12:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive