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

Enable passing named vector of col_decimals to summary.gs_design() #431

Merged
merged 5 commits into from
Jun 28, 2024

Conversation

jdblischak
Copy link
Collaborator

Closes #430

Modeled after #403

xref: #428

You can now pass a named vector to col_decimals to avoid having to repeat the default values of col_vars and col_decimals

library("gsDesign2")

before <- gs_power_ahr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) |>
  summary(
    col_vars = c("z", "~hr at bound", "nominal p", "Alternate hypothesis", "Null hypothesis"),
    col_decimals = c(4, 4, 4, 4, 4)
  )

after <- gs_power_ahr(lpar = list(sf = gsDesign::sfLDOF, total_spend = 0.1)) |>
  summary(col_decimals = c(z = 4))
## # A tibble: 6 × 7
## # Groups:   Analysis [3]
## Analysis       Bound      Z `~HR at bound` `Nominal p` `Alternate hypothesis` `Null hypothesis`
## <chr>          <chr>  <dbl>          <dbl>       <dbl>                  <dbl>             <dbl>
## 1 Analysis: 1 T… Futi… -1.17           1.54       0.879                  0.0349            0.121 
## 2 Analysis: 1 T… Effi…  2.67           0.374      0.0038                 0.0231            0.0038
## 3 Analysis: 2 T… Futi… -0.663          1.24       0.746                  0.0668            0.266 
## 4 Analysis: 2 T… Effi…  2.29           0.481      0.011                  0.0897            0.0122
## 5 Analysis: 3 T… Futi… -0.227          1.07       0.590                  0.101             0.430 
## 6 Analysis: 3 T… Effi…  2.03           0.560      0.0211                 0.207             0.025

identical(before, after)
## [1] TRUE

@jdblischak jdblischak self-assigned this Jun 27, 2024
@jdblischak
Copy link
Collaborator Author

Also, I confirmed that the tests cover all the if/else branches in both this PR and the earlier #403 to update analysis_decimals

x <- covr::package_coverage(type = "tests")
x
## R/summary.R: 93.95%
covr::report(x)

@LittleBeannie LittleBeannie merged commit 12aa2e1 into Merck:main Jun 28, 2024
7 checks passed
@jdblischak jdblischak deleted the col-decimals branch June 28, 2024 17:37
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.

Update col_decimals of the summary function
2 participants