ddediu / AdhereR

Computation of adherence to medications from Electronic Healthcare Data in R
26 stars 6 forks source link

using a date variable for start of FUW and OW #139

Closed alexadima closed 3 years ago

alexadima commented 3 years ago

trying to calculate CMA sliding window on a FUW that starts with a variable date different from dispensing events

cmaW <- CMA_sliding_window(CMA.to.apply="CMA9", # apply the simple CMA9 to each sliding window
                           data=testdataFUbyevent,
                           ID.colname = "CHI",
                           event.date.colname = "DisDate",
                           event.duration.colname = "MinDuration",
                           event.daily.dose.colname = "Min",
                           medication.class.colname = "AdhereRLabel",
                           carry.only.for.same.medication=FALSE,
                           consider.dosage.change=FALSE,
                           followup.window.start= "Nine2PregDate",
                          # followup.window.start.unit = "date",
                           followup.window.duration = 365*2,
                           followup.window.duration.unit = "days",
                           observation.window.start= "Nine2PregDate",
                          # observation.window.start.unit= "Nine2PregDate",
                           observation.window.duration=9*2,
                           sliding.window.start=0, # sliding windows definition
                           sliding.window.start.unit="months",
                           sliding.window.duration=9,
                           sliding.window.duration.unit="months",
                           sliding.window.step.duration=9,
                           sliding.window.step.unit="months",
                           date.format="%Y-%m-%d");
# Summary:
cmaW;

gives error

Error in if (!is.null(cma[[p]]) && !is.na(cma[[p]])) { : 
  missing value where TRUE/FALSE needed

dataset on private shared folder

ddediu commented 3 years ago

Fixed