[R] from data.frame to Venn diagram

Lara Poplarski larapoplarski at gmail.com
Tue Feb 28 02:23:57 CET 2012


Hello All,

I have a data.frame with this structure:

m <- matrix(sample(c(rep('yes', 10, replace = TRUE), rep('no', 10,
replace = TRUE), NA), 500, replace = TRUE), nrow = 100, ncol = 5)
colnames(m) <- colnames(m, do.NULL = FALSE, prefix = "col")
m <- as.data.frame(m)

I need to generate a Venn diagram from this data.frame, displaying the
various intersections of 'yes' for the different columns. Ideally, the
circle for each column should be proportional to the number of non-NA
entries.

The package "VennDiagram" (described here:
http://www.biomedcentral.com/1471-2105/12/35) can do all this.
However, I have not been able to figure out how to transform the
data.frame into the required list format.

Any suggestions on how to do this?

Many thanks,
Lara



More information about the R-help mailing list