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

Update in tbl_ard_summary() to assign default summary types for non-standard ARDs #2001

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

ddsjoberg
Copy link
Owner

@ddsjoberg ddsjoberg commented Sep 26, 2024

What changes are proposed in this pull request?

The most common way to determine how a variable will be summarized (e.g. continuous or categorial) is with the context column. This works well for the standard univariate summaries, but when we incorporate non-standard ARDs, no default type was assigned.

If there is an GitHub issue associated with this pull request, please provide link.
closes #1999


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

  • PR branch has pulled the most recent updates from main branch.
  • If a bug was fixed, a unit test was added.
  • Run pkgdown::build_site(). Check the R console for errors, and review the rendered website.
  • Code coverage is suitable for any new functions/features: devtools::test_coverage()
  • usethis::use_spell_check() runs with no spelling errors in documentation
  • All GitHub Action workflows pass with a ✅

When the branch is ready to be merged into master:

  • Update NEWS.md with the changes from this pull request under the heading "# gtsummary (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).
  • Increment the version number using usethis::use_version(which = "dev")
  • Run usethis::use_spell_check() again
  • Approve Pull Request
  • Merge the PR. Please use "Squash and merge".

R/tbl_ard_summary.R Outdated Show resolved Hide resolved
Comment on lines 316 to 321
ard <-
structure(list(group1 = c("trt", "trt", "trt", "trt", "trt",
"trt"), group1_level = list("Drug A", "Drug A", "Drug B", "Drug B",
"Drug A", "Drug B"), variable = c("time", "time", "time",
"time", "age", "age"), variable_level = list(12, 24, 12, 24,
NULL, NULL), context = c("survival", "survival", "survival",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something is off with the styler here

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't like this style?? 😝😝😝

Comment on lines 301 to 314
# This ARD was created with this code:
# cards::bind_ard(
# survival::survfit(survival::Surv(ttdeath, death) ~ trt, trial) |>
# cardx::ard_survival_survfit(times = c(12, 24)) |>
# dplyr::filter(stat_name %in% c("estimate")) |>
# dplyr::mutate(
# fmt_fn = list("xx.x%"),
# group1_level = unlist(group1_level) |> as.character() |> as.list()
# ),
# cardx::ard_stats_t_test_onesample(trial, variables = age, by = trt) |>
# dplyr::filter(stat_name %in% c("estimate"))
# ) |>
# dplyr::select(-cards::all_missing_columns()) |>
# dput()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not creating it? does it take a long time?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH boy, IDK what I was thinking! Updated to just build the ARDs. THANK YOU for questioning haha

Copy link
Collaborator

@Melkiades Melkiades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good for me! Thanks Daniel :)

Co-authored-by: Davide Garolini <[email protected]>
@ddsjoberg
Copy link
Owner Author

Thank you so much @Melkiades !!

@ddsjoberg ddsjoberg merged commit cfbc02a into main Sep 26, 2024
7 checks passed
@ddsjoberg ddsjoberg deleted the 1999-tbl_ard_summary-default_types branch September 26, 2024 15:55
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

Successfully merging this pull request may close these issues.

Better "default_types" assessment in tbl_ard_summary() for diverse data inputs
2 participants