Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

summary methods should not do any printing` #68

Open
gavinsimpson opened this issue Apr 3, 2015 · 1 comment
Open

summary methods should not do any printing` #68

gavinsimpson opened this issue Apr 3, 2015 · 1 comment
Labels
Milestone

Comments

@gavinsimpson
Copy link

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.

@emhart emhart added this to the 0.2.0 milestone Apr 3, 2015
@emhart emhart added the bug label Apr 3, 2015
@emhart
Copy link
Member

emhart commented Apr 3, 2015

Thanks @gavinsimpson I'll make that fix in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants