38
38
# ' interaction terms indicated by `"X1 * X2"`.
39
39
# ' @param interaction_item (`string` or `NULL`)\cr name of the variable that should have interactions
40
40
# ' 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()]
41
42
# '
42
43
# ' @return The summary of a linear model.
43
44
# '
52
53
h_ancova <- function (.var ,
53
54
.df_row ,
54
55
variables ,
55
- interaction_item = NULL ) {
56
+ interaction_item = NULL ,
57
+ weights_emmeans = NULL ) {
56
58
checkmate :: assert_string(.var )
57
59
checkmate :: assert_list(variables )
58
60
checkmate :: assert_subset(names(variables ), c(" arm" , " covariates" ))
@@ -88,7 +90,8 @@ h_ancova <- function(.var,
88
90
# Specify here the group variable over which EMM are desired.
89
91
specs = specs ,
90
92
# 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
92
95
)
93
96
94
97
emmeans_fit
@@ -117,8 +120,9 @@ s_ancova <- function(df,
117
120
conf_level ,
118
121
interaction_y = FALSE ,
119
122
interaction_item = NULL ,
123
+ weights_emmeans = NULL ,
120
124
... ) {
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 )
122
126
123
127
sum_fit <- summary(
124
128
emmeans_fit ,
@@ -300,6 +304,7 @@ summarize_ancova <- function(lyt,
300
304
conf_level ,
301
305
interaction_y = FALSE ,
302
306
interaction_item = NULL ,
307
+ weights_emmeans = NULL ,
303
308
var_labels ,
304
309
na_str = default_na_str(),
305
310
nested = TRUE ,
@@ -323,6 +328,7 @@ summarize_ancova <- function(lyt,
323
328
extra_args ,
324
329
variables = list (variables ), conf_level = list (conf_level ), interaction_y = list (interaction_y ),
325
330
interaction_item = list (interaction_item ),
331
+ weights_emmeans = weights_emmeans ,
326
332
...
327
333
)
328
334
0 commit comments