Skip to content

summary methods should not do any printing` #68

@gavinsimpson

Description

@gavinsimpson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions