I have a time series data set produced by a measuring software with the following structure:
ID1 ID2 START mes1 mes2 mes3 mes4 mes5 mes6
myidA aa 2000 12 58 45 66 88 77
myidB aa 2004 44 89 NA NA NA NA
myidC ab 2001 69 58 77 88 87 NA
myidD ab 2004 78 66 NA NA NA NA
START indicates the year of the older measurement which was saved in the first measurement column (mes1). For each sample (each line of the data frame), the start year can be different.
I'd like to create the following data frame, where measurements are ordered by years (to replace n° of measurement with years of the measure):
ID1 ID2 START 2000 2001 2002 2003 2004 2005
myidA aa 2000 12 58 45 66 88 77
myidB aa 2004 NA NA NA NA 44 89
myidC ab 2001 NA 69 58 77 88 87
myidD ab 2004 NA NA NA NA 78 66
I may have to use a time series object but I don't know how to cope with the IDs (I need to keep them) and with the START...