Skip to contents

# Create a regression model programatically

Source: `R/regression_model.R`
`regression_model_uv.Rd`

Create a regression model programatically

## Usage

    regression_model_uv(
      data,
      outcome.str,
      args.list = NULL,
      fun = NULL,
      vars = NULL,
      ...
    )

## Arguments

data

  data set

outcome.str

  Name of outcome variable. Character vector.

args.list

  List of arguments passed to 'fun' with 'do.call'.

fun

  Name of function as character vector or function to use for model creation.

vars

  character vector of variables to include

...

  ignored for now

## Value

object of standard class for fun

## Examples

    if (FALSE) { # \dontrun{
    gtsummary::trial |>
      regression_model_uv(outcome.str = "age")
    gtsummary::trial |>
      regression_model_uv(
        outcome.str = "age",
        fun = "stats::lm",
        args.list = NULL
      )
    gtsummary::trial |> regression_model_uv(
      outcome.str = "trt",
      fun = "stats::glm",
      args.list = list(family = stats::binomial(link = "logit"))
    )
    } # }