HI ,
I have a dataframe looks like this
actual_df <- data.frame(time = seq(1,10,3),
a1 = c(1,2,3,4),
a2 = c(2,5,7,8),
a3 = c(1,3,5,6))
i want add the third and fourth columns as rows, and keep the first column repeated. Below is the output i need
needed_df <- data.frame(time = rep(seq(1,10,3),3),
ID = rep(c("a1","a2","a3"),each = 4),
DV = c(1,2,3,4,2,5,7,8,1,3,5,6))
Thanks for your help