Skip to content

Commit e2031f3

Browse files
committed
Added weights_emmeans argument to summarize_ancova()
1 parent 00d657e commit e2031f3

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Refactored `afun_riskdiff()`, `count_occurrences()`, `count_occurrences_by_grade()`, `count_patients_with_event()`, `count_patients_with_flags()`, `count_values()`, `estimate_incidence_rate()`, `h_tab_one_biomarker()`, `summarize_change()`, `summarize_colvars()`, `summarize_patients_exposure_in_cols()`, `survival_time()`, `tabulate_rsp_subgroups()`, `tabulate_survival_subgroups()`, `tabulate_rsp_biomarkers()`, and `tabulate_survival_biomarkers()` to align with new analysis function style.
77
* Converted `as_factor_keep_attributes()` to an exported function.
88
* Added `denom` parameter to `estimate_proportion()`.
9+
* Added `weights_emmeans` argument to `summarize_ancova()`.
910

1011
### Bug Fixes
1112
* Fixed bug in `a_count_patients_with_flags()` preventing select custom label and indentation specification formats from being applied.

R/summarize_ancova.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ NULL
3838
#' interaction terms indicated by `"X1 * X2"`.
3939
#' @param interaction_item (`string` or `NULL`)\cr name of the variable that should have interactions
4040
#' with arm. if the interaction is not needed, the default option is `NULL`.
41+
#' @param weights_emmeans (`string` or `NULL`)\cr argument from [emmeans::emmeans()]
4142
#'
4243
#' @return The summary of a linear model.
4344
#'
@@ -52,7 +53,8 @@ NULL
5253
h_ancova <- function(.var,
5354
.df_row,
5455
variables,
55-
interaction_item = NULL) {
56+
interaction_item = NULL,
57+
weights_emmeans = NULL) {
5658
checkmate::assert_string(.var)
5759
checkmate::assert_list(variables)
5860
checkmate::assert_subset(names(variables), c("arm", "covariates"))
@@ -88,7 +90,8 @@ h_ancova <- function(.var,
8890
# Specify here the group variable over which EMM are desired.
8991
specs = specs,
9092
# Pass the data again so that the factor levels of the arm variable can be inferred.
91-
data = .df_row
93+
data = .df_row,
94+
weights = weights_emmeans
9295
)
9396

9497
emmeans_fit
@@ -117,8 +120,9 @@ s_ancova <- function(df,
117120
conf_level,
118121
interaction_y = FALSE,
119122
interaction_item = NULL,
123+
weights_emmeans = NULL,
120124
...) {
121-
emmeans_fit <- h_ancova(.var = .var, variables = variables, .df_row = .df_row, interaction_item = interaction_item)
125+
emmeans_fit <- h_ancova(.var = .var, variables = variables, .df_row = .df_row, interaction_item = interaction_item, weights_emmeans = weights_emmeans)
122126

123127
sum_fit <- summary(
124128
emmeans_fit,
@@ -300,6 +304,7 @@ summarize_ancova <- function(lyt,
300304
conf_level,
301305
interaction_y = FALSE,
302306
interaction_item = NULL,
307+
weights_emmeans = NULL,
303308
var_labels,
304309
na_str = default_na_str(),
305310
nested = TRUE,
@@ -323,6 +328,7 @@ summarize_ancova <- function(lyt,
323328
extra_args,
324329
variables = list(variables), conf_level = list(conf_level), interaction_y = list(interaction_y),
325330
interaction_item = list(interaction_item),
331+
weights_emmeans = weights_emmeans,
326332
...
327333
)
328334

man/h_ancova.Rd

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/summarize_ancova.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)