Skip to content

Commit

Permalink
Merge branch 'main' into 1238_mtx_form_indent@main
Browse files Browse the repository at this point in the history
  • Loading branch information
edelarua committed May 10, 2024
2 parents 2a6a83a + bfb529f commit 8827f8d
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 15 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tern
Title: Create Common TLGs Used in Clinical Trials
Version: 0.9.4.9004
Date: 2024-04-29
Version: 0.9.4.9005
Date: 2024-05-10
Authors@R: c(
person("Joe", "Zhu", , "joe.zhu@roche.com", role = c("aut", "cre")),
person("Daniel", "Sabanés Bové", , "daniel.sabanes_bove@roche.com", role = "aut"),
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# tern 0.9.4.9004
# tern 0.9.4.9005

### Enhancements
* Added `facet_var` to `g_lineplot` to allow plot faceting by a factor variable.
* Updated `g_lineplot` legend to follow factor levels set by users.
* Added examples and tests for `label_all` parameter to `extract_survival_biomarkers` and `extract_survival_subgroups`.

### Bug Fixes
* Fixed bug in `s_ancova` that prevented statistics from being printed when arm levels include special characters.

### Miscellaneous
* Began deprecation of the unused `label_all` parameter to `tabulate_survival_biomarkers` and `tabulate_survival_subgroups`, with redirection to the same parameter in their associated `extract_*` functions.

Expand Down
4 changes: 3 additions & 1 deletion R/summarize_ancova.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ s_ancova <- function(df,
adjust = "none"
)

contrast_lvls <- gsub(paste0(" - ", .ref_group[[arm]][1], ".*"), "", sum_contrasts$contrast)
contrast_lvls <- gsub(
"^\\(|\\)$", "", gsub(paste0(" - \\(*", .ref_group[[arm]][1], ".*"), "", sum_contrasts$contrast)
)
if (!is.null(interaction_item)) {
sum_contrasts_level <- sum_contrasts[grepl(sum_level, contrast_lvls, fixed = TRUE), ]
} else {
Expand Down
2 changes: 0 additions & 2 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ADTTE
AE
ANCOVA
Agresti
Bové
Byar's
CDISC
CMH
Expand All @@ -27,7 +26,6 @@ Newcombe
Pre
Rua
SMQ
Sabanés
Satterthwaite
Schouten
TLG
Expand Down
32 changes: 23 additions & 9 deletions tests/testthat/_snaps/summarize_ancova.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,27 @@
Code
res
Output
ARM A ARM B (x) ARM C
(N=69) (N=73) (N=58)
——————————————————————————————————————————————————————————————
Unadjusted comparison
n 552 584 464
Mean 0.01 0.01 -0.05
Difference in Means 0.06 0.06
95% CI (-0.07, 0.19) (-0.06, 0.19)
p-value 0.3442 0.3186
ARM A ARM B (x) ARM C
(N=69) (N=73) (N=58)
——————————————————————————————————————————————————————————
Unadjusted comparison
n 552 584 464
Mean 0.01 0.01 -0.05
Difference in Means 0.06
95% CI (-0.07, 0.19)
p-value 0.3442

---

Code
res
Output
10mg/kg 20mg/kg 30mg/kg
————————————————————————————————————————————————————————————————————————
ARMCD
n 69 73 58
Adjusted Mean 6.30 6.75 6.16
Difference in Adjusted Means 0.45 -0.14
95% CI (-0.70, 1.60) (-1.36, 1.08)
p-value 0.4433 0.8214

23 changes: 23 additions & 0 deletions tests/testthat/test-summarize_ancova.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,27 @@ testthat::test_that("summarize_ancova works with irregular arm levels", {

res <- testthat::expect_silent(result2)
testthat::expect_snapshot(res)

adsl <- adsl |>
mutate(
ARMCD = case_match(
ARMCD,
"ARM A" ~ "10mg/kg",
"ARM B" ~ "20mg/kg",
"ARM C" ~ "30mg/kg"
) |> factor(levels = paste0(1:3, "0mg/kg")),
)

result3 <- basic_table() |>
split_cols_by("ARMCD", ref_group = "10mg/kg") |>
summarize_ancova(
vars = "BMRKR1",
variables = list(arm = "ARMCD"),
conf_level = 0.95,
var_labels = "ARMCD"
) |>
build_table(adsl)

res <- testthat::expect_silent(result3)
testthat::expect_snapshot(res)
})

0 comments on commit 8827f8d

Please sign in to comment.