Description Usage Arguments Details Value Examples
This function takes your dataset (crea.rep or similar) and aligns BMI event.dates with creatinine measurement event.dates. It will add a BMI column with NAs at the beginning and then fill it with corresponding BMI values while running. It loops through each patient ID, finds all event.dates and CodeValues for BMI in this patient, finds the closest event.date to creatinine event.date (not necessarily after the creatinine event), and saves this BMI value. It is saving a new dataframe row by row, in every loop.
1 | addBMI(crea.dataset, bmi.dataset, NbOfCores = 4L, filename)
|
crea.dataset |
dataset with creatinine ReadCodes, at least three creatinine measurements per patient. |
bmi.dataset |
file with extracted BMI codes from SIR data (codes starting with" 22K"); duplicates removed, NA free. All columns from SIR data can be present. |
NbOfCores |
how much cores do you want to use for your parallel process? Will be added to getOption() from mclapply. Default is 4 (should work on any PC), but can be changed to less or more. |
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. |
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".
This function returns output file of mclapply function. Can be useful to save the output to a file in case an error occurrs because you can find error details in the output file. The creatinine data with BMI is automatically saved to a .txt file, row by row, and can later be accessed by using "read.table" function.
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.