format chr as factor and stratify baseline

This commit is contained in:
Andreas Gammelgaard Damsbo 2024-11-15 22:22:17 +01:00
commit 419faca242
No known key found for this signature in database
5 changed files with 78 additions and 29 deletions

View file

@ -15,7 +15,7 @@
#'
#' @examples
#' gtsummary::trial |>
#' regression_model(outcome.str = "age")
#' regression_model(outcome.str = "age",)
#' gtsummary::trial |>
#' regression_model(
#' outcome.str = "age",
@ -35,7 +35,11 @@ regression_model <- function(data,
args.list = NULL,
fun = NULL,
vars = NULL) {
if (!is.null(formula.str) | formula.str != "") {
if (formula.str==""){
formula.str <- NULL
}
if (!is.null(formula.str)) {
formula.str <- glue::glue(formula.str)
} else {
assertthat::assert_that(outcome.str %in% names(data),