-1
如何在空白/缺失值時使下面的數據框行獨一無二地取決於第二列?如何使用帶空白/缺失值的獨特功能
> head(interproscan)
V1 V14
1 sp0000001-mRNA-1
2 sp0000001-mRNA-1
3 sp0000001-mRNA-1
4 sp0000005-mRNA-1 GO:0003723
5 sp0000006-mRNA-1 GO:0016021
6 sp0000006-mRNA-1 GO:0016021
> head(unique(interproscan[ , 1:2]))
V1 V14
1 sp0000001-mRNA-1
4 sp0000005-mRNA-1 GO:0003723
5 sp0000006-mRNA-1 GO:0016021
7 sp0000006-mRNA-2 GO:0016021
9 sp0000006-mRNA-3 GO:0016021
目標將是:
V1 V14
1 sp0000001-mRNA-1
4 sp0000005-mRNA-1 GO:0003723
5 sp0000006-mRNA-1 GO:0016021
預先感謝您
'庫(tidyverse); interproscan%>%distinct(V14,.keep_all = T)'適合你的目標。還有別的嗎? – Tunn
'庫(tidyverse); > InterProScan的%>%不同(V14,.keep_all = T) V1 V14 1:sp0000001體mRNA-1 NA >頭(InterProScan的) V1 V14 1:sp0000001體mRNA-1 NA 2:sp0000001體mRNA -1 NA 3:sp0000001-mRNA-1 NA 4:sp0000005-mRNA-1 NA 5:sp0000006-mRNA-1 NA 6:sp0000006-mRNA-1 NA' – user977828