Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Select unique characters present in one list in a list of lists

I am trying to filter all the characters that are present in a that are not present in b and c. I want to do this from the list l.

a<-c("A", "B", "C", "D", "E")
b<-c("A", "E", "I", "O", "U")
c<-c("H", "E", "L", "L", "O")
l<-list(a,b,c)

So the answer should be BCD.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

you can try the code below

> d <- table(stack(setNames(l, seq_along(l))))

> row.names(d)[d[, 1] == 1 & rowSums(d) == 1]
[1] "B" "C" "D"
`` 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading