clean_disease_expose: Disease-Exposure Cleaning Function

View source: R/clean_disease_expose.R

clean_disease_exposeR Documentation

Disease-Exposure Cleaning Function

Description

Takes disease-exposure data and makes all columns binary, which is needed to use other functions in the package

Usage

clean_disease_expose(data, disease, noDisease = NULL, exposures)

Arguments

data

The data.frame containing disease-exposure data

disease

Quoted name or unquoted numeric value of the column containing the disease status data

noDisease

Optional, with a default of NULL. A quoted string specifying how disease status equal to not diseased is listed in the disease column.

exposures

The column(s) containing exposure data, either given as a vector of quoted names or unquoted numeric values or a single quoted name or unquoted numeric value (if there is only one exposure)

Value

A data.frame containing binary variables for disease and exposure data

Examples

de_data <- disease_expose_data # read in example data provided in package
cleaned_de_data <- clean_disease_expose(data = de_data, disease = "disease", noDisease = "No", exposures = c("exposure1", "exposure2", "exposure3")) # clean the data using specific columns in the dataset

cleaned2 <- clean_disease_expose(data = de_data, disease = "disease", noDisease = "No", exposures = c(3,4,5)) # clean the data again, but use the number of each exposure column instead

cleaned3 <- clean_disease_expose(data = de_data, disease = 2, exposures = c("exposure1", "exposure2", "exposure3")) # clean the data, but use the number of the disease column instead of the name and don't give a noDisease value

npeters1322/hospEpi documentation built on April 30, 2022, 6:12 p.m.