I am an R newbie. Trying to tidy a dataset, a portion of which is below (the actual dataset has 10000 rows and columns).I am trying to tidy it by gathering them in pairs.
id start event1 event2 event2 date1 date2 date2
1 06/07/2011 A B C 06/07/2011 06/07/2011 06/07/2011
1 06/07/2011 NA NA NA
1 06/07/2011 - NA NA NA
2 15/07/2011 D E A 18/07/2011 18/07/2011 16/07/2011
3 15/07/2011 D C H 19/07/2011 19/07/2011 14/08/2011
4 22/08/2011 G 04/09/2011 NA NA
4 22/08/2011 - NA NA NA
What I want to achieve is this:
start event_date event
06/07/2011 06/07/2011 A
06/07/2011 06/07/2011 B
06/07/2011 06/07/2011 C
15/07/2011 18/07/2011 D
And so on, converting to the long format with preserving the temporal link between dates and events and removing all 'non-events'.