Calculate an SDTM --DY value from a date and a reference date
make_dy.Rd
Calculate an SDTM --DY value from a date and a reference date
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.
See also
Other Date management and conversion:
dateany_to_date()
,
generate_dtc()
,
is_ISO8601_calendar_datetime()
,
is_ISO8601_calendar_date()
,
is_ISO8601_ordinal_datetime()
,
is_ISO8601_timezone()
,
is_ISO8601_time()
,
is_ISO8601_week_datetime()
,
pattern_ISO8601_any_datetime()
,
pattern_ISO8601_any_date()
,
pattern_ISO8601_calendar_datetime()
,
pattern_ISO8601_calendar_date()
,
pattern_ISO8601_calendar_year()
,
pattern_ISO8601_ordinal_datetime()
,
pattern_ISO8601_ordinal_date()
,
pattern_ISO8601_timezone()
,
pattern_ISO8601_time()
,
pattern_ISO8601_week_datetime()
,
pattern_ISO8601_week_date()
,
sdtm_dtc_to_datetime()
,
sdtm_first_dose()
,
sdtm_time_actual()
Examples
make_dy(c("2022-01-02", "2022-01-03", "2022-01-04"), "2022-01-03")
#> [1] -1 1 2