I have a table like follows:
library(data.table)
dt <- data.table(t0.id=1:2,t0.V1=c("a","e"),t0.V2=c("b","f"),t1.id=3:4,t1.V1=c("c","g"),t1.V2=c("d","h"))
dt
   t0.id t0.V1 t0.V2 t1.id t1.V1 t1.V2
1:     1     a     b     3     c     d
2:     2     e     f     4     g     h
and I want to copy data from row one to a new row, like this:
   t0.id t0.V1 t0.V2 t1.id t1.V1 t1.V2
1:     1     a     b                  
2:                       3     c     d
3:     2     e     f     4     g     h
I know how to duplicate the row (I've seen this post), but I don't know how to clear columns by condition (eg. t0.id==1) since both rows would be equal.
I guess it could be done by row index, but my real table has thousands of rows and I don't think that's the best way to do it.
Thank you
EDIT:
- The final order of rows doesn't matter, that is, final rows no 1 and 2 don't need to be next to each other.
- I 'manually' (by looking at some variables) identify which rows need to be split. So, the only condition to be applied is based on 't0.id'.
 
    