2017-06-22 70 views
3

对不起,可能有重复,但我甚至无法用文字描述我想要的内容。变换列表r

这里是我有什么现在(名单列表)

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

我需要得到

id1 one 
id1 two 
id1 three 
id2 one 
id3 one 

等等...帮助。 我需要这个从UniProt Retrieve ID表创建Blast2GO自定义.annot文件。

+0

你可能有兴趣阅读的概念“整洁的数据”:http://vita.had.co.nz/papers/tidy-data.pdf – bli

+1

只要做'library(splitstackshape); cSplit(df1,'col2',';','long')' – akrun

+0

试试'unlist'。 – CPak

回答

0

我们可以用cSplit这个

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

注:假设第二列名是“COL2”和对象名称为“DF1”