Create an iterator that goes every year/month, from stime. If etime is set, the iterator would go every year/month until the last point which is <= etime. If month or years is set, the iterator would be set for every year/month ntimes. If both parameters are set, the iterator would go from etime until the early between n times and etime.

emr_monthly_iterator(stime, etime = NULL, n = NULL)

emr_yearly_iterator(stime, etime = NULL, n = NULL)

Arguments

stime

the date of the first point in machine format (use emr_date2time)

etime

end of time scope (can be NULL if months parameter is set)

n

number of months / years

Value

an id time data frame that can be used as an iterator

Examples

iter <- emr_monthly_iterator(emr_date2time(1, 1, 2002), emr_date2time(1, 1, 2017))
# note that the examples database doesn't include actual dates, so the results are empty
emr_extract("dense_track", iterator = iter, stime = 1, etime = 3)
#> [1] id          time        ref         dense_track
#> <0 rows> (or 0-length row.names)

iter <- emr_monthly_iterator(emr_date2time(1, 1, 2002), n = 15)
emr_extract("dense_track", iterator = iter, stime = 1, etime = 3)
#> [1] id          time        ref         dense_track
#> <0 rows> (or 0-length row.names)