Skip to contents

Calculate non overlapping time.

Usage

interval_real_period(
  data,
  patient_id = "patient_id",
  st_dates = "prec_start_date",
  end_dates = "prec_end_date"
)

Arguments

data

prescription patient table

patient_id

a "patient_id" column name or a similar column

st_dates

a "Prescription start time" column name or a similar column

end_dates

a "Prescription end time" column name or a similar column

Value

Actual non overlapping medication days per patient

Details

At least three column names must be given, including "patient id", "prescription start time","prescription end time".

Examples

if (FALSE) {
## Build data
prec_data = data_med$prec %>%
  mutate(prec_end_date = as.Date(prec_date) + sample(1:30,1)) %>%
  rename(prec_start_date = prec_date)

interval_real_period(prec_data,patient_id = "patient_id",
                     st_dates = "prec_start_date",
                     end_dates = "prec_end_date")
}