Converts date and hour to internal time format.

emr_date2time(day, month, year, hour = 0)

Arguments

day

vector of days of month in [1, 31] range

month

vector of months in [1, 12] range

year

vector of years

hour

vector of hours in [0, 23] range

Value

Vector of converted times.

Details

This function converts date and hour to internal time format. Note: the earliest valid time is 1 March 1867.

Note: if one of the arguments ('day', ...) is a vector, then the other arguments must be vectors two of identical size or scalars. Internally a data frame is built out of all the vectors or scalars before the conversion is applied. Hence rules for data frame creation apply to this function.

Examples


emr_db.init_examples()
#> NULL

# 30 January, 1938, 6:00 - birthday of Islam Karimov
t <- emr_date2time(30, 1, 1938, 6)
emr_time2hour(t)
#> [1] 6
emr_time2dayofmonth(t)
#> [1] 30
emr_time2month(t)
#> [1] 1
emr_time2year(t)
#> [1] 1938

# cover all times when Islam Karimov could have been born
# (if we don't know the exact hour!)
t <- emr_date2time(30, 1, 1938, 0:23)