我有character
vector
list
一個S:刪除重複的元素
my.list <- list(e1 = c("a","b","c","k"),e2 = c("b","d","e"),e3 = c("t","d","g","a","f"))
而且我正在尋找一個function
,對於出現比整個list
的vector
一度以上(在任何character
每個vector
一個character
只能出現一次),只會保持第一次出現。
這個例子的結果列表將因此會:
res.list <- list(e1 = c("a","b","c","k"),e2 = c("d","e"),e3 = c("t","g","f"))
注意,可能的是,在list
整個vector
被消除,使得元件在所得list
數量不一定必須等於輸入list
。