View source: R/proportionDaysCovered.R
pdc_treatment | R Documentation |
Calculates adherence to drug treatments based on the proportion of days covered method.
pdc_treatment( serialDf, startDates, endDates, atcCode = c(), refillPeriod = 90, idColumn = "PATIENT", dateColumn = "VISIT", atcColumn = "ATC", treatmentBreakDays = c(), absenceDays = NULL, createGraphs = F, savePrescriptionTable = F )
serialDf |
the data frame with prescription data |
startDates |
a data frame containing the start dates of the study for each patient |
endDates |
a data frame containing the end dates of the study for each patient |
atcCode |
a vector containing regular expressions, each encoding for one component/drug class of the treatment |
refillPeriod |
length of a prescription refill period in days (default 90 days) |
idColumn |
name of ID column: default is PATIENT |
dateColumn |
name of date column: default is VISIT. This column has to be of class Date |
atcColumn |
name of the column with the ATC codes: default is ATC |
treatmentBreakDays |
a vector containing the number of days (one entry for each drug class) after which the treatment is considered discontinued (default: no breaks applied) |
absenceDays |
a data frame containing start dates and end dates of absences for each patient. This time will be removed from the calculation. The first day should be stored in a column called START and the final in one called END. (optional) |
createGraphs |
flag indicating whether graphs should be produced (default: FALSE) |
savePrescriptionTable |
flag indicating whether the whole prescription table should be saved in a file (default: FALSE) |
adherence rates for the full prescription period and between start and end dates
## Not run: dfStart <- read_tsv('/home/ad/home/s/stefmutt/projects/former/cadGRS/data/bl_all_new.txt') %>% select(PATIENT, VISIT) dfEnd <- dfStart %>% mutate(VISIT = as.Date('2015-12-31')) kela <- read_tsv('/home/ad/home/s/stefmutt/projects/former/cadGRS/data/kela_all.txt') %>% filter(!is.na(ATC)) %>% select(-all_ddd) %>% filter(PATIENT %in% dfStart$PATIENT) adherences <- pdc_treatment(serialDf = kela, startDates = dfStart, endDates = dfEnd, atcCode = c('^C09', '^C10'), refillPeriod = 90, idColumn = "PATIENT", dateColumn = "VISIT", atcColumn = "ATC", createGraphs = T, treatmentBreakDays = c(181,181), absenceDays = NULL) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.