Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ LazyData: true
VignetteBuilder: knitr
Depends: R (>= 4.1.0)
Imports:
glue,
metalite,
r2rtf,
stats,
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Further speed up unstratified confidence intervals in `extend_ae_specific_inference()` by computing every term's interval in one vectorized pass: the bisection grid is evaluated across all terms at once and every sign-change bracket is refined by a single vectorized bisection loop, instead of scanning the grid separately for each term. Stratified inputs still use `rate_compare_sum()` per term. Results are unchanged up to floating-point tolerance (#257, thanks to @yihui).
- Speed up `prepare_ae_specific()` by dropping an unused `order()` pre-sort of the full observation table when collecting the distinct SOC/preferred-term pairs; the downstream `merge()` re-sorts by key and the row order is derived from factor levels, so the sort never affected the output. Results are unchanged for valid MedDRA data (one system organ class per preferred term) (#259, thanks to @yihui).
- Trim per-call allocations in the Miettinen-Nurminen variance helper (replacing `ifelse()` with sign arithmetic and indexed assignment) and reset row names before the Total-group `rbind()` in `prepare_ae_specific()` to avoid a costly `make.unique()`. Results are unchanged (#260, thanks to @yihui).
- Drop the `glue` dependency, replacing its four `glue::glue_data()` call sites with base R (`sprintf()` and `gsub()`); output is unchanged (#265, thanks to @yihui).
- De-duplicate the Miettinen-Nurminen CI computation in `rate_compare_sum_unstratified()`: identical `(n0, n1, x0, x1)` tuples are solved once and expanded back. The core computation is extracted into a private `mn_ci_batch()`. Halves `prepare_ae_forestly()` time on large inputs (#263, thanks to @yihui).

# metalite.ae 0.1.4
Expand Down
4 changes: 1 addition & 3 deletions R/gt_ae_specific.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ gt_ae_specific <- function(outdata,
}

if (!is.null(meddra_version)) {
footnotes <- vapply(footnotes, glue::glue_data,
.x = list(meddra_version = meddra_version), FUN.VALUE = character(1)
)
footnotes <- gsub("{meddra_version}", meddra_version, footnotes, fixed = TRUE)
}

names(footnotes) <- NULL
Expand Down
8 changes: 4 additions & 4 deletions R/prepare_ae_specific.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ prepare_ae_specific <- function(meta,
pop_n$order <- 1

# Define Observation section
obs_n$name <- c(
"with one or more {tolower(term1)} adverse events {tolower(term2)}",
"with no {tolower(term1)} adverse events {tolower(term2)}"
par_map <- collect_adam_mapping(meta, parameter)
obs_n$name <- sprintf(
c("with one or more %s adverse events %s", "with no %s adverse events %s"),
tolower(par_map$term1), tolower(par_map$term2)
)
obs_n$name <- vapply(obs_n$name, glue::glue_data, .x = collect_adam_mapping(meta, parameter), FUN.VALUE = character(1))
# Remove duplicate space
obs_n$name <- gsub("^ *|(?<= ) | *$", "", obs_n$name, perl = TRUE)

Expand Down
4 changes: 1 addition & 3 deletions R/tlf_ae_specific.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ tlf_ae_specific <- function(outdata,
}
}

footnotes <- vapply(footnotes, glue::glue_data,
.x = list(meddra_version = meddra_version), FUN.VALUE = character(1)
)
footnotes <- gsub("{meddra_version}", meddra_version, footnotes, fixed = TRUE)
names(footnotes) <- NULL

if (!all(outdata$n_pop == 0)) {
Expand Down
5 changes: 1 addition & 4 deletions R/tlf_ae_specific_subgroup.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,7 @@ tlf_ae_specific_subgroup <- function(
)
}

footnotes <- vapply(
footnotes, glue::glue_data,
.x = list(meddra_version = meddra_version), FUN.VALUE = character(1)
)
footnotes <- gsub("{meddra_version}", meddra_version, footnotes, fixed = TRUE)
names(footnotes) <- NULL

out_all <- outdata$out_all
Expand Down
Loading