-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added function to restore types in ARDs (#231)
**What changes are proposed in this pull request?** * Methods in the {survey} and {survival} packages do not retain inputs variables types in their outputs. We now are able retain these variable types in ARDs returned by `ard_continuous.survey.design()`, `ard_categorical.survey.design()`, `ard_continuous_ci.survey.design()`, `ard_categorical_ci.survey.design()`, and `ard_survival_survfit.data.frame()`. The survey results were being all converted to character, which resulted in incorrect ordering/sorting downstream. I was trying to handle each case separately, but in the end it's just easier to handle the issue at the source (despite this code being a bit ugly). -------------------------------------------------------------------------------- Pre-review Checklist (if item does not apply, mark is as complete) - [x] **All** GitHub Action workflows pass with a ✅ - [x] PR branch has pulled the most recent updates from master branch: `usethis::pr_merge_main()` - [x] If a bug was fixed, a unit test was added. - [x] If a new `ard_*()` function was added, it passes the ARD structural checks from `cards::check_ard_structure()`. - [x] If a new `ard_*()` function was added, `set_cli_abort_call()` has been set. - [x] If a new `ard_*()` function was added and it depends on another package (such as, `broom`), `is_pkg_installed("broom")` has been set in the function call and the following added to the roxygen comments: `@examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom""))` - [x] Code coverage is suitable for any new functions/features (generally, 100% coverage for new code): `devtools::test_coverage()` Reviewer Checklist (if item does not apply, mark is as complete) - [ ] If a bug was fixed, a unit test was added. - [ ] Code coverage is suitable for any new functions/features: `devtools::test_coverage()` When the branch is ready to be merged: - [ ] Update `NEWS.md` with the changes from this pull request under the heading "`# cardx (development version)`". If there is an issue associated with the pull request, reference it in parentheses at the end update (see `NEWS.md` for examples). - [ ] **All** GitHub Action workflows pass with a ✅ - [ ] Approve Pull Request - [ ] Merge the PR. Please use "Squash and merge" or "Rebase and merge".
- Loading branch information
Showing
17 changed files
with
288 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
48 changes: 25 additions & 23 deletions
48
tests/testthat/_snaps/ard_categorical_ci.survey.design.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
# ard_categorical_ci(data) | ||
|
||
Code | ||
dplyr::select(as.data.frame(ard_categorical_ci(dclus1, variables = c(both, | ||
awards))), -warning, -error, -fmt_fn, -context) | ||
dplyr::select(ard_categorical_ci(dclus1, variables = c(both, awards)), -warning, | ||
-error, -fmt_fn, -context) | ||
Message | ||
{cards} data frame: 20 x 5 | ||
Output | ||
variable variable_level stat_name stat_label stat | ||
1 both No estimate estimate 0.273224 | ||
2 both No conf.low conf.low 0.2131745 | ||
3 both No conf.high conf.high 0.342819 | ||
4 both No method method logit | ||
5 both No conf.level conf.level 0.95 | ||
6 both Yes estimate estimate 0.726776 | ||
7 both Yes conf.low conf.low 0.657181 | ||
8 both Yes conf.high conf.high 0.7868255 | ||
9 both Yes method method logit | ||
10 both Yes conf.level conf.level 0.95 | ||
11 awards No estimate estimate 0.2896175 | ||
12 awards No conf.low conf.low 0.2241835 | ||
13 awards No conf.high conf.high 0.3651608 | ||
14 awards No method method logit | ||
15 awards No conf.level conf.level 0.95 | ||
16 awards Yes estimate estimate 0.7103825 | ||
17 awards Yes conf.low conf.low 0.6348392 | ||
18 awards Yes conf.high conf.high 0.7758165 | ||
19 awards Yes method method logit | ||
20 awards Yes conf.level conf.level 0.95 | ||
variable variable_level stat_name stat_label stat | ||
1 both No estimate estimate 0.273 | ||
2 both No conf.low conf.low 0.213 | ||
3 both No conf.high conf.high 0.343 | ||
4 both No method method logit | ||
5 both No conf.level conf.lev… 0.95 | ||
6 both Yes estimate estimate 0.727 | ||
7 both Yes conf.low conf.low 0.657 | ||
8 both Yes conf.high conf.high 0.787 | ||
9 both Yes method method logit | ||
10 both Yes conf.level conf.lev… 0.95 | ||
11 awards No estimate estimate 0.29 | ||
12 awards No conf.low conf.low 0.224 | ||
13 awards No conf.high conf.high 0.365 | ||
14 awards No method method logit | ||
15 awards No conf.level conf.lev… 0.95 | ||
16 awards Yes estimate estimate 0.71 | ||
17 awards Yes conf.low conf.low 0.635 | ||
18 awards Yes conf.high conf.high 0.776 | ||
19 awards Yes method method logit | ||
20 awards Yes conf.level conf.lev… 0.95 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.