I am having trouble figuring out the most elegant and flexible way to switch data from long format to wide format when I have more than one measure variable I want to bring
reshape(my.df, idvar = "ID", timevar = "TIME", direction = "wide")
gives
ID X.1 Y.1 X.2 Y.2 X.3 Y.3 X.4 Y.4 X.5 Y.5 1 A 1 16 4 19 7 22 10 25 13 28 2 B 2 17 5 20 8 23 11 26 14 29 3 C 3 18 6 21 9 24 12 27 15 30