I have data frame Table
as follows:
Date Task
1 575171-02-1
2 571120-01-7, 712102-01-1, 712102-02-1, 712202-01-1
3 535105-01-5, 532137-01-2
4 572036-01-6, 532170-01-2
I want output like this:
Task Date
575171-02-1 1
575171-02-1 1
712102-01-1 1
712102-02-1 1
712202-01-1 2
535105-01-5 3
...
I tried to create new data frames in loop of loop
for (i in 1:nrow(Table)) {
X<-strsplit(Table$Task[i],", ")
for (j in 1:length(X))
{ Date<-Table$Date[i]
Task<-X[j]
I don't know how can I create new data frame in second loop, so when i
turn to new loop it will not be overwritten