ddediu / AdhereR

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

Check !is.na() for the required parameters in compute_event_durations() and time_to_initiation() #21

Closed ddediu closed 5 years ago

ddediu commented 5 years ago

Now, it is unclear which of the parameters in these functions are required not to be NA; for example, in compute_event_durations() it is not checked if !is.na(medication.class.colnames) (only if it isn't, and if it is included in the column names), which means that passing medication.class.colname=NA results in an ugly crash:

Error in `[.data.table`(disp.data, get(ID.colname) == pat, c(ID.colname,  : 
  column(s) not found: NA
ddediu commented 5 years ago
Masswear commented 5 years ago

I removed the default NAs for all required arguments in the function call definition, and also removed them from the manual. This way, someone would have to explicitely define one of these parameters as NA, which imho justifies an ugly crash ;).