List transformation r

Sorry for the possible duplication, but I can't even describe in words what I want.

Here's what I have now (list of lists)

id1 one; two; three
id2 one
id3 one; two; three; four
id4 one; two

      

What do I need to get

id1 one
id1 two
id1 three
id2 one
id3 one 

      

so on ... Help. I need this to create a custom .annot Blast2GO file from the UniProt Retrieve ID table.

+3


source to share


1 answer


We can use cSplit

for this

library(splitstackshape)
cSplit(df1, 'col2', ';', 'long')

      



NOTE. Assuming the second column name is "col2" and the object name is "df1"

0


source







All Articles