-
Notifications
You must be signed in to change notification settings - Fork 2
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
Standardize output #31
Comments
The test starting on this line hows the different outputs to be reduced.
|
For descriptiveness sake; may also reduce confusion when #31 is worked on
|
Functions now output an object of class contingencytables_output, a method of which is created for `print()`. Unit tests are adapted accordingly.
Planning ahead for unit test breakage caused by further development of #31.
This should accommodate different sets of output, since the class is defined (as best as S3 can, that is) as a list of `name` and `statistics`.
In preparation for creation of subclasses to better organize printing methods
On second though, it may be better to just have the two subclasses as their own thing. They can be grouped into a superclass if it makes sense, in the future.
Saves one line per function, so around 160 lines in gross (120 net) total.
New idea: giving the instantiator the same name as the class.
Improved output of Exact_unconditional_test_2x2 (#31) Improved output of Fisher exact and midP (#31) Improved output of FisherFreemanHalton_asymptotic_test_rxc (#31) Improved output of FleissEveritt_test_paired_cxc (#31) Improved output of gamma_coefficient_rxc_bca (#31) Improved output of gamma_coefficient_rxc (#31) Improved output of Gart_adjusted_logit_CI_2x2 (#31) Improved output of Gold_Wald_CIs_1xc (#31) Improved output of Goodman_Wald_CIs_1xc (#31) Improved output of Goodman_Wald_CIs_for_diffs_1xc (#31) Improved output of Goodman_Wilson_score_CIs_1xc (#31)
We should try having the print format be an attribute. This way, we could retain backwards-compatibility because the statistics elements could be moved up I've level. As a bonus, the print format stays hidden (user doesn't care about it anyway). |
One potential issue to the above would be that we would end up with a class with a dynamic amount of attributes instead of the current standard in development. Might not be such a big deal, but something to briefly consider. |
Not sure if fixing #27 will consequently solve this, but something could be done to standardize the output of similar functions. See, for example, how
Wald_CI_1x2(X = 250, n = 533)
outputs a vector whereasLR_CI_1x2(X = 13, n = 16)
outputs a string.Here's a list of remaining functions:
A convenient way to work through the list is by using the https://github.com/ocbe-uio/contingencytables/blob/b0acdc14fd27c3616bf37d55ffab33d9b110c89b/tests/testthat/test-outputFormat.R file.
The text was updated successfully, but these errors were encountered: