bug in regression_table flow
Some checks failed
pkgdown.yaml / pkgdown (push) Has been cancelled

This commit is contained in:
Andreas Gammelgaard Damsbo 2025-05-12 13:58:45 +02:00
parent a82a5c6378
commit 6db500d13a
No known key found for this signature in database
3 changed files with 23 additions and 4 deletions

View file

@ -1,3 +1,7 @@
# FreesearchR 25.5.5
- *FIX* several minor bugs and polish
# FreesearchR 25.5.4 # FreesearchR 25.5.4
- *FIX* correctly omit NAs in `data_type()` call - *FIX* correctly omit NAs in `data_type()` call

View file

@ -96,15 +96,17 @@
#' # gtsummary::bold_p() #' # gtsummary::bold_p()
#' } #' }
regression_table <- function(x, ...) { regression_table <- function(x, ...) {
args <- list(...)
if ("list" %in% class(x)) { if ("list" %in% class(x)) {
x |> x |>
purrr::map(\(.m){ purrr::map(\(.m){
regression_table_create(x = .m, ...) |> regression_table_create(x = .m, args.list = args) |>
gtsummary::add_n() gtsummary::add_n()
}) |> }) |>
gtsummary::tbl_stack() gtsummary::tbl_stack()
} else { } else {
regression_table_create(x, ...) regression_table_create(x, args.list = args)
} }
} }

View file

@ -7090,18 +7090,31 @@ symmetrical_scale_x_log10 <- function(plot, breaks = c(1, 2, 3, 5, 10), ...) {
#' # gtsummary::bold_p() #' # gtsummary::bold_p()
#' } #' }
regression_table <- function(x, ...) { regression_table <- function(x, ...) {
args <- list(...)
if ("list" %in% class(x)) { if ("list" %in% class(x)) {
x |> x |>
purrr::map(\(.m){ purrr::map(\(.m){
regression_table_create(x = .m, ...) |> regression_table_create(x = .m, args.list = args) |>
gtsummary::add_n() gtsummary::add_n()
}) |> }) |>
gtsummary::tbl_stack() gtsummary::tbl_stack()
} else { } else {
regression_table_create(x, ...) regression_table_create(x, args.list = args)
} }
} }
#' Create regression summary table
#'
#' @param x (list of) regression model
#' @param ... ignored for now
#' @param args.list args.list for the summary function
#' @param fun table summary function. Default is "gtsummary::tbl_regression"
#' @param theme summary table theme
#'
#' @returns gtsummary list object
#' @export
#'
regression_table_create <- function(x, ..., args.list = NULL, fun = "gtsummary::tbl_regression", theme = c("jama", "lancet", "nejm", "qjecon")) { regression_table_create <- function(x, ..., args.list = NULL, fun = "gtsummary::tbl_regression", theme = c("jama", "lancet", "nejm", "qjecon")) {
# Stripping custom class # Stripping custom class
class(x) <- class(x)[class(x) != "freesearchr_model"] class(x) <- class(x)[class(x) != "freesearchr_model"]