I want to get vennCounts
data components of Venn's diagram as a row in R.
Data components in Venn's diagram where N44 is about points outside circles (here 10)
Output of the code
Expected output with any separator
51 & 0 & 0 & 10
& 0 & 0 & 10 &
50
Code to make Venn's diagrams from matrices
library('ggplot2')
library('limma') # vennCounts, vennDiagram
library("psych") # http://stackoverflow.com/a/13112799/54964 corr.test(M.cor, adjust = "none"), replaces default cor.test
makeVennCountsFromPMatrices <- function(M.cor)
{
p.mat.all <- psych::corr.test(M.cor, adjust = "none", ci = F)
alpha <- c(0.05)
p.mat.p <- (p.mat.all[["p"]] < alpha) # http://stackoverflow.com/a/6559049/54964
p.mat.t <- (p.mat.all[["t"]] < alpha)
p.mat.r <- (p.mat.all[["r"]] < alpha)
# http://www.ats.ucla.edu/stat/r/faq/venn.htm
c3 <- cbind(c(p.mat.p), c(p.mat.t), c(p.mat.r))
a <- vennCounts(c3)
str(a)
vennDiagram(a,
names = c("1", "2", "3"),
cex = 2, counts = "red"
)
}
M.cor <- cor(mtcars)
makeVennCountsFromPMatrices(M.cor)
Output from vennCounts
but nothing there seems to be about Nij counts
VennCounts [1:8, 1:4] 0 0 0 0 1 1 1 1 0 0 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:8] "1" "2" "3" "4" ...
..$ : chr [1:4] "Group 1" "Group 2" "Group 3" "Counts"
R: 3.3.1
OS: Debian 8.5