I have the following table:
sp0000001-mRNA-1
sp0000005-mRNA-1 GO:0003723
sp0000006-mRNA-1 GO:0016021
sp0000007-mRNA-1 GO:0003700|GO:0006355|GO:0043565
The aim would be to generate new rows for GO ids which were separated by |
. From the above example it would lead to 2 more rows
sp0000001-mRNA-1
sp0000005-mRNA-1 GO:0003723
sp0000006-mRNA-1 GO:0016021
sp0000007-mRNA-1 GO:0003700
sp0000007-mRNA-1 GO:0006355
sp0000007-mRNA-1 GO:0043565
How is it possible to do it R?
Thank you in advance
library(splitstackshape); cSplit(df, "V2", "|", "long")
tidyr::separate_rows
tidyr::unnest