I am trying to built a patent network. I have a sample dataframe (aa) that contains an ID variable (origin) and string character (Target). I want to split the string character into separate groups and then add it back to the dataframe in long format so that it shows up as a new dataframe (ab). I've tried a few things trying to combine strsplit, do.call and reshape functions but to no avail. Appreciate any help.
From
aa<-data.frame(Origin=c(1,2,3),Target=c('a b c','d e','f g a b'))
aa
to
ab<-data.frame(Origin=c(rep(1,3),rep(2,2),rep(3,4)), Target=c('a','b','c','d','e','f','g','a','b'))
ab