ff_permute: Permuate explanatory variables to produce multiple output...

Description Usage Arguments Value Examples

View source: R/ff_permute.R

Description

Permuate explanatory variables to produce multiple output tables for common regression models

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
ff_permute(
  .data,
  dependent = NULL,
  explanatory_base = NULL,
  explanatory_permute = NULL,
  multiple_tables = FALSE,
  include_base_model = TRUE,
  include_full_model = TRUE,
  base_on_top = TRUE,
  ...
)

finalfit_permute(
  .data,
  dependent = NULL,
  explanatory_base = NULL,
  explanatory_permute = NULL,
  multiple_tables = FALSE,
  include_base_model = TRUE,
  include_full_model = TRUE,
  base_on_top = TRUE,
  ...
)

Arguments

.data

Data frame or tibble.

dependent

Character vector of length 1: quoted name of dependent variable. Can be continuous, a binary factor, or a survival object of form Surv(time, status).

explanatory_base

Character vector of any length: quoted name(s) of base model explanatory variables.

explanatory_permute

Character vector of any length: quoted name(s) of explanatory variables to permute through models.

multiple_tables

Logical. Multiple model tables as a list, or a single table including multiple models.

include_base_model

Logical. Include model using explanatory_base variables only.

include_full_model

Logical. Include model using all explanatory_base and explanatory_permute variables.

base_on_top

Logical. Base variables at top of table, or bottom of table.

...

Other arguments to finalfit

Value

Returns a list of data frame with the final model table.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
explanatory_base = c("age.factor", "sex.factor")
explanatory_permute = c("obstruct.factor", "perfor.factor", "node4.factor")

# Linear regression
colon_s %>%
  finalfit_permute("nodes", explanatory_base, explanatory_permute)

# Cox proportional hazards regression
colon_s %>%
  finalfit_permute("Surv(time, status)", explanatory_base, explanatory_permute)

# Logistic regression
# colon_s %>%
#   finalfit_permute("mort_5yr", explanatory_base, explanatory_permute)

# Logistic regression with random effect (glmer)
# colon_s %>%
#   finalfit_permute("mort_5yr", explanatory_base, explanatory_permute,
#     random_effect = "hospital")

finalfit documentation built on June 11, 2021, 5:17 p.m.