[R] remove repeated string in list

JS Huang js.huang at protective.com
Thu Mar 5 04:56:01 CET 2015


  To avoid hardcoded 1:3, here is some revision.

> temp
[1] "a" "b" "d" "x"

[1] "b" "c" "q" "m"

[1] "b" "f" "e" "k" "q" "h"

> sapply(1:*length(temp)*,function(x){temp[[x]][as.numeric(table(unlist(temp))[temp[[x]]])==1]})
[1] "a" "d" "x"

[1] "c" "m"

[1] "f" "e" "k" "h"

View this message in context: http://r.789695.n4.nabble.com/remove-repeated-string-in-list-tp4704166p4704190.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list