View source: R/helperFunctions.R
findClosestToBaseline | R Documentation |
Finds the measurement date that is closest to baseline in the given time period around baseline.
findClosestToBaseline( serialDf, baselineDates, blDayDiff = 90, idColumn = "PATIENT", dateColumn = "VISIT", dataColumn = "MEASURE" )
idColumn |
name of ID column: default is PATIENT |
dateColumn |
name of date column: default is VISIT. This column has to be of class Date |
dataColumn |
name of the data column: default is MEASURE |
df |
the data frame to check |
dayDiff |
time around baseline (default: 90 days, will look three months before and after baseline) |
data frame with baseline measure or NA if no measurement was close to baseline
## Not run: baselinePatients <- read_tsv('../data/ourBaselinePatients.txt', guess_max = 3582) %>% select(PATIENT, VISIT = VISIT_TL) bmi <- read_tsv('../data/serial_bmi.txt') # contains serial and baseline data baselinePatients <- findClosestToBaseline(bmi, baselinePatients, blDayDiff = 90) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.