powered by
Perform residual adjustment on an epidemiologic variable
residual_adjust(d, variable, confounder, label, verbose = FALSE)
The original d object, with an extra column reflecting residual adjustments on the selected variable.
d
the input data frame on which to perform the adjustment
character. Name of variable needing adjustment
character. Name of the confounder to adjust for
character. Name to give the adjusted variable
logical. Print updates to console?
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