Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed Aug 3, 2024
1 parent cdf1421 commit a1f2ee6
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tidycmprsk
Title: Competing Risks Estimation
Version: 1.0.0.9000
Version: 1.0.0.9001
Authors@R: c(
person(c("Daniel", "D."), "Sjoberg", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0003-0862-2018")),
Expand All @@ -16,7 +16,7 @@ License: AGPL (>= 3)
URL: https://mskcc-epi-bio.github.io/tidycmprsk/, https://github.com/MSKCC-Epi-Bio/tidycmprsk
BugReports: https://github.com/MSKCC-Epi-Bio/tidycmprsk/issues
Depends:
R (>= 3.4)
R (>= 4.2)
Imports:
broom (>= 1.0.1),
cli (>= 3.1.0),
Expand Down
25 changes: 25 additions & 0 deletions tests/testthat/_snaps/gtsummary_s3_methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# tbl_regression.tidycrr()

Code
as.data.frame(tbl_regression(crr(Surv(ttdeath, death_cr) ~ age + grade, trial)))
Output
11 cases omitted due to missing values
**Characteristic** **log(HR)** **95% CI** **p-value**
1 Age 0.01 -0.01, 0.03 0.6
2 Grade <NA> <NA> <NA>
3 I <NA> <NA> <NA>
4 II 0.06 -0.65, 0.77 0.9
5 III 0.43 -0.20, 1.1 0.2

# global_pvalue_fun.tidycrr()

Code
as.data.frame(tbl, col_labels = FALSE)
Output
label estimate conf.low p.value
1 Age 0.01 -0.01, 0.03 0.6
2 Grade <NA> <NA> 0.3
3 I <NA> <NA> <NA>
4 II 0.06 -0.65, 0.77 <NA>
5 III 0.43 -0.20, 1.1 <NA>

26 changes: 26 additions & 0 deletions tests/testthat/test-gtsummary_s3_methods.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
test_that("tbl_regression.tidycrr()", {
expect_snapshot(
crr(Surv(ttdeath, death_cr) ~ age + grade, trial) |>
tbl_regression() |>
as.data.frame()
)
})

test_that("global_pvalue_fun.tidycrr()", {
mod <- crr(Surv(ttdeath, death_cr) ~ age + grade, trial)
expect_error(
tbl <- mod |>
tbl_regression() |>
gtsummary::add_global_p(),
NA
)
expect_snapshot(tbl |> as.data.frame(col_labels = FALSE))

expect_equal(
tbl$table_body$p.value[1:2],
cardx::ard_aod_wald_test(mod) |>
dplyr::filter(stat_name %in% "p.value") |>
dplyr::pull(stat) |>
unlist()
)
})

0 comments on commit a1f2ee6

Please sign in to comment.