I am having trouble using the reshape2 package for the following purpose.
I have a dataframe which looks like:
ID = c("1")
TIME1 = c("0.5")
TIME2 = c("1")
TIME3 = c("2")
TIME4 = c("5")
DF = data.frame(ID, TIME1, TIME2, TIME3, TIME4)
I would like to transform it in order to obtain the following dataframe:
ID = c("1","1","1","1")
TIME = c("0.5", "1", "2","5")
DF2 = data.frame(ID, TIME)
where ID is repeated in the column.
I apologize a bunch if I have overlooked similar answers on this forum, I just can't seem to wrap my head around the melt and dcast functions and their content.
Furthermore, if any other packages than reshape2 are useful/quicker for this scenario, do not hesitate to post them.
Thank you in advance.
Sincerily,
ykl