Learn R Programming

PAutilities (version 1.1.0)

residual_adjust: Perform residual adjustment on an epidemiologic variable

Description

Perform residual adjustment on an epidemiologic variable

Usage

residual_adjust(d, variable, confounder, label, verbose = FALSE)

Value

The original d object, with an extra column reflecting residual adjustments on the selected variable.

Arguments

d

the input data frame on which to perform the adjustment

variable

character. Name of variable needing adjustment

confounder

character. Name of the confounder to adjust for

label

character. Name to give the adjusted variable

verbose

logical. Print updates to console?

Examples

Run this code
d <- data.frame(
  VARIABLE = rnorm(100, 10, 2),
  CONFOUNDER = rnorm(100, 3, 7)
)
result <- residual_adjust(d, "VARIABLE", "CONFOUNDER", "ADJUSTED")

head(d)
head(result)

Run the code above in your browser using DataLab