I am currently working in R in data table and have two date columns (first_day and last_day) that I need to merge together into one date column (date). This needs to be done so that the column has the dates in order from smallest to largest by group (id).
Here is the data I'm working with:
ID first_day last_day
1 1/12/2005 1/15/2005
2 2/15/2006 2/19/2006
2 3/8/2006 3/12/2006
3 1/9/2008 1/13/2008
Here is what I'm trying to get the result to look like:
ID first_day last_day Date
1 1/12/2005 1/15/2005 1/12/2005
1 1/12/2005 1/15/2005 1/15/2005
2 2/15/2006 2/19/2006 2/15/2006
2 2/15/2006 2/19/2006 2/19/2006
2 3/8/2006 3/12/2006 3/8/2006
2 3/8/2006 3/12/2006 3/12/2006
3 1/9/2008 1/13/2008 1/9/2008
3 1/9/2008 1/13/2008 1/13/2008
Any assistance is greatly appreciated!