Skip to content

Commit

Permalink
added progressbar.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolski committed Feb 10, 2025
1 parent 9a500fc commit 28fa447
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/tidyMS_R6_Modelling.R
Original file line number Diff line number Diff line change
Expand Up @@ -920,14 +920,20 @@ contrasts_linfct <- function(models,
interaction_models <- vector(mode = "list", length = nrow(models))

if ("matrix" %in% class(linfct)) {
pb <- progress::progress_bar$new(total = length(models[[modelcol]]))
for (i in seq_along(models[[modelcol]])) {
interaction_models[[i]] <- contrastfun(models[[modelcol]][[i]], linfct = linfct)
pb$tick()
}
interaction_model_matrix <- models
interaction_model_matrix$contrast <- interaction_models
} else if (("list" %in% class(linfct)) && (length(linfct) == nrow(models))) {
pb <- progress::progress_bar$new(total = length(models[[modelcol]]))

for (i in seq_along(models[[modelcol]])) {

interaction_models[[i]] <- contrastfun(models[[modelcol]][[i]], linfct = linfct[[i]])
pb$tick()
}
interaction_model_matrix <- models
interaction_model_matrix$contrast <- interaction_models
Expand Down

0 comments on commit 28fa447

Please sign in to comment.