ddediu / AdhereR

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

allow vector input for map.event.coords.to.plot #197

Open Masswear opened 1 year ago

Masswear commented 1 year ago

map.event.coords.to.plot accepts only a single value for x (and presumably y). It would be useful to supply x as a vector of event dates, e.g. to annotate multiple events at once.

Reproducible example:

cma7 <- CMA7(data=med.events[med.events$PATIENT_ID %in% c(1,2),],
             ID.colname="PATIENT_ID",
             event.date.colname="DATE",
             event.duration.colname="DURATION",
             event.daily.dose.colname="PERDAY",
             medication.class.colname="CATEGORY",
             followup.window.start=0,
             followup.window.start.unit="days",
             followup.window.duration=2*365,
             followup.window.duration.unit="days",
             observation.window.start=30,
             observation.window.start.unit="days",
             observation.window.duration=365,
             observation.window.duration.unit="days",
             date.format="%m/%d/%Y",
             summary="Base CMA");

map.event.coords.to.plot(x = cma7$event.info$.DATE.as.Date) #returns error: Error in if (is.na(x)) { : the condition has length > 1