Learn R Programming

interactionR (version 0.1.7)

interactionR_table: Publication-ready tables for effect modification and interaction analysis

Description

Generates a publication-ready table for effect modification and interaction analysis based on Tables 1 and 3 in Knol and Vanderweele (2012) [tools:::Rd_expr_doi("10.1093/ije/dyr218")]. Users can modify the function's output like any flextable object @seealso flextable. The confidence intervals for additive interaction measures will be as selected from the interactionR function

Usage

interactionR_table(obj, p.value = FALSE, file_path = NA)

Value

saves a publication-ready microsoft word Table corresponding to Table 1 or Table 3 respectively in Knol and Vanderweele (2012) to the working directory (with user's permission). It also returns an object of class flextable corresponding to the saved table for further manipulation.

Arguments

obj

An object of class 'interactionR' generated from any of the main functions in the interactionR package

p.value

Includes p-values in the generated table if set to TRUE. Default is FALSE.

file_path

An optional user-specified string representing the file path to save the generated Word table instead of the current working directory

Examples

Run this code
library(interactionR)
data(OCdata)

## fit the interaction model
model.glm <- glm(oc ~ alc * smk,
  family = binomial(link = "logit"),
  data = OCdata
)
## Then pass the fitted model to the main function
value <- interactionR(model.glm,
  exposure_names = c("alc", "smk"),
  ci.type = "delta", ci.level = 0.95,
  em = FALSE, recode = FALSE
)

## Use the tabling function to generate a table
interactionR_table(value)

Run the code above in your browser using DataLab