I have a list TF2Gene[1326] which looks like
view(TF2Gene)
structure(list(Sp1=c("a","b","c"),p53=c("x","y","z"),Elk1=c("1","2","3"),...))
So its basically a list of 1326 lists.
Now I want to concatenate the values of these lists in 1 so that I can find the unique members. What I am doing is:
cols <- unique(unlist(TF2Gene))
Is this correct?
Yes, that is the correct way to do it. On the example above the result would be a vector like:
c("a", "b", "c", "x", "y", "z", "1", "2", "3")
That's only going to work if your lists have atomic elements. Mine usually don't. Try this instead.
do.call(c, list (list( 3,4,5 ) , list( "a","b" )))
[[1]]
[1] 3
[[2]]
[1] 4
[[3]]
[1] 5
[[4]]
[1] "a"
[[5]]
[1] "b"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With