determining at most 1 hour time difference between car and non-car mode

I have

 household       person     start time   
      1           1          07:45:00    
      1           2          09:45:00    
      1           3          22:45:00    
      1           4          08:45:00    
      1           1          06:45:00    
      2           1          07:45:00   
      2           2          016:45:00   

I want to find a column to find if non-car mode is at most 1 hour before a car mode in each family.

I need that column to be index of a person or persons who has/have this time intersection with another one.

In the above example first family, the time of first person is 1 hour before person 4 so in new column 4 infant of first person and 1 infant of 4th person.
output:

  household       person  time.    mode        overlap
      1           1          07:45:00    non-car           2,4
      1           2          20:50:00    car                  3,1
      1           3          19:55:00    non-car           2
      1           4          20:45:00    car                  1,2
      1           1          18:45:00    non-car           2    
      2           1          07:45:00    non-car            0
      2           2          016:45:00   car                 0

no intersection with other family member is 0 or whatever like NA

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.