根据换档时间创建矩阵

时间:2019-02-21 17:00:35

标签: r

我每小时都有这样的日期:

3:00:00 AM TO 4:00:00 AM
4:00:00 AM TO 5:00:00 AM
5:00:00 AM TO  6:00:00 AM
6:00:00 AM TO 7:00:00 AM
7:00:00 AM TO 8:00:00 AM
8:00:00 AM TO 9:00:00 AM
9:00:00 AM TO 10:00:00 AM
10:00:00 AM TO 11:00:00 AM
11:00:00 AM TO 12:00:00 PM
12:00:00 PM TO 1:00:00 PM
1:00:00 PM TO  2:00:00 PM
2:00:00 PM TO 3:00:00 PM
3:00:00 PM TO 4:00:00 PM
4:00:00 PM TO 5:00:00 PM
5:00:00 PM TO 6:00:00 PM
6:00:00 PM TO 7:00:00 PM
7:00:00 PM TO  8:00:00 PM
8:00:00 PM TO 9:00:00 PM
9:00:00 PM TO 10:00:00 PM
10:00:00 PM TO 11:00:00 PM
11:00:00 PM TO 12:00:00 AM

和连续几天的轮班时间顺序

3AM-11AM 5AM-1:30PM 7AM-3:30 PM 8AM-4:30PM 9AM-5:30PM 10AM-6:30PM 12PM-8:30PM 2PM-10:30PM   6PM-2:30AM 11PM-7:30AM

如果小时数在轮班时间中下降,我需要创建二进制值1或0矩阵。 例如,第一行应为

1   0   0   0   0   0   0   0   0   0

第三应该是

1   1   0   0   0   0   0   0   0   0

谢谢

0 个答案:

没有答案