I have attach the photo that describe transpose issue from table 1 to table 2. May I seek your solution for this ?

I have attach the photo that describe transpose issue from table 1 to table 2. May I seek your solution for this ?

 
    
     
    
    We can do this with melt/dcast from data.table.  In the devel version, there is rowid to create a sequence column by group.  
library(data.table)#1.9.7+
dcast(melt(setDT(table1), id.var = 'ID', variable.name = "V"),
               V + rowid(ID)~ID, value.var = "value")[, ID := NULL][]
If we are using versions 1.9.6 or below,
dcast(melt(setDT(table), id.var = "ID", variable.name = "V")[,
   rn := 1:.N, by = ID], V + rn ~ID, value.var = "value")[, ID := NULL][]
table1 <- data.frame(ID = rep(c("GroupA", "GroupB"), c(7, 5)), 
       V1 = c(2, 2, 4, 3, 1,6, 7, 8, 11, 3, 1, 6),
       V2 = c(2, 4, 2, 7, 1, 8, 5, 9, 12, 21, 4, 6))
