-
Notifications
You must be signed in to change notification settings - Fork 10
Description
summary methods should not, by themselves do any printing. What they should do is create (and return) an R object that has all the information you wish to include in the summary. This object should have the class "summary.foo" if the summary method is summary.foo(). Then you add a print method for class summary.foo, print.summary.foo(), and it is that print method that should write messages to the screen and/or print all or parts of that summary.
Here is one instance in EcoSimR where you don't follow the proper conventions:
https://github.com/GotelliLab/EcoSimR/blob/master/R/coccurrence_null.R#L78
The reason for this convention is that if the summary information is that useful/interesting to the user, they might want that information in an R object, hence the summary creates & returns that object and it's own print method then handles showing the printed representation to the user.