addDiabetes: Adding diabetes data to your final file

Description Usage Arguments Details Value Examples

View source: R/addVariables.R

Description

This function takes your dataset (crea.rep or similar) and finds diabetes information on each patient in crea dataset. For each patient it first finds the earliest event.date of diabetes and then searches for the closest creatinine event.date (making sure that crea event.date was chronologically *after* the diabetes date)

Usage

1
addDiabetes(crea.dataset, diabetes.dataset, NbOfCores = 4L, filename)

Arguments

crea.dataset

dataset with creatinine ReadCodes, at least three creatinine measurements per patient.

diabetes.dataset

file with extracted BMI codes from SIR data (codes starting with" 22K"); duplicates removed, NA free

NbOfCores

how much cores do you want to use for your parallel process? Will be added to getOption() from mclapply. Default is 4.

filename

name of the final .txt file your output will be saved to. Can be a path also. Should be a txt file because of write.table function inside.

Details

This function uses parallel lapply - mclapply from "parallel" package. It's recommended to either run it in the background of your PC or on the cluster. The column used for time analysis is named "event.date".

Value

This function returns out file of mclapply function. Can be useful to save the output to a file in case an error occurrs. You can find error details in that output file. The creatinine data with diabetes is automatically saved to a .txt file, row by row, and can later be accessed by using "read.table" function.

Examples

1
2
3
4
## Not run: 
addBMI(crea.dataset, diabetes.dataset = diabetes, NbOfCores=4L, filename = "creaWithDiabetes.txt")

## End(Not run)

dkurtoic/addVariables documentation built on May 30, 2019, 8:28 a.m.