I\'m looking to transform a data frame of 660 columns into 3 columns just by stacking them on each other per 3 columns without manually re-arranging (since I have 660 column
reshape to the rescue:
reshape
reshape(df, direction="long", varying=split(names(df), rep(seq_len(ncol(df)/2), 2))) # time A B id #1.1 1 1 4 1 #2.1 1 2 5 2 #3.1 1 3 6 3 #1.2 2 7 10 1 #2.2 2 8 11 2 #3.2 2 9 12 3