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

help files for s3 methods #323

Open
till-tietz opened this issue Mar 14, 2024 · 7 comments
Open

help files for s3 methods #323

till-tietz opened this issue Mar 14, 2024 · 7 comments
Assignees

Comments

@till-tietz
Copy link
Collaborator

not sure if this will do the trick but here is a stackoverflow issue about this

https://stackoverflow.com/questions/7198758/roxygen2-how-to-properly-document-s3-methods

@gerasy1987
Copy link
Collaborator

gerasy1987 commented Mar 14, 2024

Seems that despite the fact that S3 methods are not exported in package, you can still access the help files for them using ?plot.causal_model or ?print.causal_model (the latter works on master branch since I documented that method). So all we need is to write a proper roxygen2 skeleton for plot.causal_model.

@till-tietz @macartan I see that plot_dag() has a help file now but it is not intended to be used by users. Do we need to keep plot_dag() at all or could it be worth it to superseed this function by plot.causal_model() and then document the plot method? Right now it does not make sense since plot method is just a wrapper for plot_dag().

@macartan
Copy link
Collaborator

macartan commented Mar 14, 2024 via email

@gerasy1987
Copy link
Collaborator

@macartan this could be a solution, yes. I'm pretty sure we can add a see also section to the help file and reference the plot method.

@macartan
Copy link
Collaborator

macartan commented Mar 14, 2024 via email

@gerasy1987
Copy link
Collaborator

gerasy1987 commented Mar 14, 2024

There is a way to force print help information for methods inside help file of "parent" function: we just need to us @rdname [FUNCTION_NAME], e.g.

@rdname summary.causal_model

This makes me think whether we want to have a special help page for causal_model-class where we can print all corresponding S3 methods. I tried to look for it, and it is not very straightforward for S3 as opposed to S4, but could be possible.

@till-tietz
Copy link
Collaborator Author

@gerasy1987 I think your proposal above would be fantastic!!! Let's see if we can figure it out

@gerasy1987
Copy link
Collaborator

gerasy1987 commented Mar 21, 2024

I already implemented the brute force approach with @rdname for print and summary methods for causal_model class objects produced by update_model(). Now the issue here is that those print and summary methods also apply to make_model() function, but there is no easy way to include those methods in two help files ( see here )

Given that S3Class does not really support standalone help pages, maybe the way to go is to list all relevant S3 Methods (including plot) in the most base function that produces the causal_model class, i.e. make_model() and then in update_model() just reference the make_model() help file?

For example see ?plot.ecdf(). Also this could potentially be a solution to the plot issue @macartan mentioned above. I.e. users can always come back to ?make_model() help file to review plot.causal_model() arguments.

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

No branches or pull requests

3 participants