我有一個數據如下所示DF如何刪除重複的字符串併合並所有列字符串?
df<- structure(list(V1 = structure(c(5L, 1L, 2L, 3L, 4L), .Label = c("DNAJC11;FGOTG",
"MAPK14", "PPIB", "RBX1", "USP14"), class = "factor"), V2 = structure(c(4L,
3L, 2L, 1L, 1L), .Label = c("", "DNAJC9", "MAPK14", "USP14"), class = "factor"),
V3 = structure(c(3L, 2L, 4L, 5L, 1L), .Label = c("", "DNAJC11;FGOTG",
"GCLC", "GSR", "STIP1"), class = "factor")), .Names = c("V1",
"V2", "V3"), class = "data.frame", row.names = c(NA, -5L))
我想所有列合併成一個,然後保持獨特的人 例如輸出應該是這樣的
USP14
DNAJC11;FGOTG
MAPK14
PPIB
RBX1
DNAJC9
GCLC
GSR
STIP1
我試着使用melt
功能,但我不知道如何做到這一點,任何意見表示讚賞。由於
'unlist'然後'unique'? – rawr
@rawr感謝您的回覆,如果您不介意,請作出回答,但如果不值得,請不要擔心,我會嘗試使用unlist功能。再次感謝 – nik