I am working with radio communications data that has the following data structure (P1-P5 are recipient columns):
Index Onset Terminus Duration Sender Net P1 P2 P3 P4 P5
1 1 4 3 P1 N1 0 1 1 1 0
2 6 10 4 P2 N2 0 0 1 1 0
3 11 16 5 P3 N2 0 1 1 1 0
I am trying to convert the data into a structure like this:
Time Onset Terminus Duration Sender Net P1 P2 P3 P4 P5
1 1 4 3 P1 N1 0 1 1 1 0
2 1 4 3 P1 N1 0 1 1 1 0
3 1 4 3 P1 N1 0 1 1 1 0
4 1 4 3 P1 N1 0 1 1 1 0
5 n/a n/a n/a n/a n/a n/a n/a n/a n/a n/a
6 6 10 4 P2 N2 0 0 1 1 0
In other words, to format the data for time-series analysis while preserving everything else. It looks like I need to add a row for every missing unit of time, and also expand the 'Onset' and 'Terminus' columns into individual units of time. I would appreciate any help for this! Thank you, g