R/time_bins.R
rules2timebins.Rd
Converts a list of human readable rules to a functional that maps any datetime stamp to a time bin.
rules2timebins(rules)
rules | A list of lists of rules, each sublist must contain 4 variables, |
---|
a function that maps any datetime stamp to the associated time bins.
Unassigned time is by default tagged with Other
# NOT RUN { rules = list( list(start='6:30', end= '9:00', days = 1:5, tag='MR'), list(start='15:00', end= '18:00', days = 2:5, tag='ER') ) time_bins <- rules2timebins(rules) time_bins(Sys.time()) # }