Skip to contents

Calculate an SDTM --DY value from a date and a reference date

Usage

make_dy(dates, refdt)

Arguments

dates

The dates for calculation

refdt

The dates for reference

Value

An integer vector with days since the reference date according to SDTM calculation rules: If dates < refdt, the difference in days; if dates >= refdt, the difference in days plus one.

Details

dates and refdt is passed through dateany_to_date() to ensure that they are R Date class objects.

Examples

make_dy(c("2022-01-02", "2022-01-03", "2022-01-04"), "2022-01-03")
#> [1] -1  1  2