Hello,

Imagine 3 lists like so:

> a <- list("A","B","C","D")
> b <- list("A","B","E","F")
> c <- list("A","C","E","G")

What I need (vennDiagram) is a matrix characterizing with 1 or 0 whether any
given member is present or not like so:
     x1 x2 x3
[1,]  1  1  1
[2,]  1  1  0
[3,]  1  0  1
[4,]  1  0  0
[5,]  0  1  1
[6,]  0  1  0
[7,]  0  0  1

(where the rows represent "A"-"G" and the columns a-c, respectively).

> table(c(a,b,c))
will give me a quick answer for the "1 1 1" case, but how to deal with the
other cases efficiently without looping over each string and looking for
membership %in% each list?

Thanks for enlightening the learning,

Joh

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to