insightsengineering / cardx

R Package to Supplement ARD Functions Found in {cards}
https://insightsengineering.github.io/cardx/
Other
14 stars 2 forks source link

Updating `ard_proportion_ci()` to accept categorical variables #158

Closed ddsjoberg closed 5 months ago

ddsjoberg commented 5 months ago

What changes are proposed in this pull request?

cardx::ard_proportion_ci(
  mtcars, 
  variables = cyl
) |> 
  dplyr::filter(stat_name %in% c("N", "estimate", "conf.low", "conf.high"))
#> {cards} data frame: 12 x 9
#>    variable variable_level   context stat_name stat_label  stat
#> 1       cyl              4 proporti…         N          N    32
#> 2       cyl              4 proporti…  estimate   estimate 0.344
#> 3       cyl              4 proporti…  conf.low   conf.low 0.164
#> 4       cyl              4 proporti… conf.high  conf.high 0.524
#> 5       cyl              6 proporti…         N          N    32
#> 6       cyl              6 proporti…  estimate   estimate 0.219
#> 7       cyl              6 proporti…  conf.low   conf.low  0.06
#> 8       cyl              6 proporti… conf.high  conf.high 0.378
#> 9       cyl              8 proporti…         N          N    32
#> 10      cyl              8 proporti…  estimate   estimate 0.438
#> 11      cyl              8 proporti…  conf.low   conf.low  0.25
#> 12      cyl              8 proporti… conf.high  conf.high 0.625
#> ℹ 3 more variables: fmt_fn, warning, error

Created on 2024-05-25 with reprex v2.1.0

closes #154


Pre-review Checklist (if item does not apply, mark is as complete)

Reviewer Checklist (if item does not apply, mark is as complete)

When the branch is ready to be merged:

github-actions[bot] commented 5 months ago

badge

Code Coverage Summary

Filename                               Stmts    Miss  Cover    Missing
-----------------------------------  -------  ------  -------  ------------------------------------
R/ard_aod_wald_test.R                     77       8  89.61%   36-41, 91, 94
R/ard_attributes.survey.design.R           2       0  100.00%
R/ard_car_anova.R                         45       2  95.56%   62, 65
R/ard_car_vif.R                           61       2  96.72%   52, 86
R/ard_continuous.survey.design.R         194       2  98.97%   172, 182
R/ard_effectsize_cohens_d.R              102       2  98.04%   68, 121
R/ard_effectsize_hedges_g.R               97       2  97.94%   68, 127
R/ard_emmeans_mean_difference.R           70       0  100.00%
R/ard_proportion_ci.R                     90       5  94.44%   115-119
R/ard_regression_basic.R                  16       1  93.75%   46
R/ard_regression.R                        51       0  100.00%
R/ard_smd_smd.R                           68       5  92.65%   58, 84-87
R/ard_stats_anova.R                       95       0  100.00%
R/ard_stats_aov.R                         36       0  100.00%
R/ard_stats_chisq_test.R                  39       1  97.44%   39
R/ard_stats_fisher_test.R                 42       1  97.62%   42
R/ard_stats_kruskal_test.R                35       1  97.14%   38
R/ard_stats_mcnemar_test.R                79       2  97.47%   63, 105
R/ard_stats_mood_test.R                   48       1  97.92%   46
R/ard_stats_oneway_test.R                 38       0  100.00%
R/ard_stats_prop_test.R                   84       1  98.81%   43
R/ard_stats_t_test_onesample.R            40       0  100.00%
R/ard_stats_t_test.R                     111       2  98.20%   65, 111
R/ard_stats_wilcox_test_onesample.R       41       0  100.00%
R/ard_stats_wilcox_test.R                 98       2  97.96%   65, 117
R/ard_survey_svychisq.R                   37       1  97.30%   44
R/ard_survey_svyranktest.R                51       0  100.00%
R/ard_survey_svyttest.R                   50       0  100.00%
R/ard_survival_survdiff.R                 89       0  100.00%
R/ard_survival_survfit_diff.R             76       8  89.47%   31-34, 43-46
R/ard_survival_survfit.R                 174      13  92.53%   79-81, 85, 95-97, 128-132, 237
R/construction_helpers.R                  68      11  83.82%   154, 166-170, 196-200
R/proportion_ci.R                        195      28  85.64%   290, 293, 302-307, 315, 330, 438-461
TOTAL                                   2399     101  95.79%

Diff against main

Filename                 Stmts    Miss  Cover
---------------------  -------  ------  -------
R/ard_proportion_ci.R      +48       0  +6.35%
R/proportion_ci.R           +1       0  +0.07%
TOTAL                      +49       0  +0.09%

Results for commit: b38dc2767f1ecb85ebdd6dd634349f22762ffbe2

Minimum allowed coverage is 80%

:recycle: This comment has been updated with latest results

github-actions[bot] commented 5 months ago

Unit Tests Summary

  1 files   71 suites   10s :stopwatch:  71 tests  47 :white_check_mark: 24 :zzz: 0 :x: 204 runs  168 :white_check_mark: 36 :zzz: 0 :x:

Results for commit b38dc276.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 5 months ago

Unit Test Performance Difference

Additional test case details | Test Suite | $Status$ | Time on `main` | $±Time$ | Test Case | |:-----|:----:|:----:|:----:|:-----| | ard_proportion_ci | 👶 | | $+0.01$ | ard_proportion_ci_messaging |

Results for commit c521ec6c2acf4d61e34724ac03b8acb10619b0d7

♻️ This comment has been updated with latest results.

ddsjoberg commented 5 months ago

Ahh, thank you @zdz2101 !! Would you mind adding a unit test using these args so I don't accidentally break it in the future?