Skip to content
Prev 29745 / 63424 Next

Constructor blah() vs. as.blah()

When should we use one versus the other?  If I'm designing an S3 class
"blah", should I just implement

blah <- function(x, ...) UseMethod("blah")

and then a bunch of blah.whatever() functions, including blah.default()?
Or should I do

as.blah <- function(x, ...) UseMethod("as.blah")

with a bunch of methods for it?  Or do both?  

Jeff