Difference between revisions of "VennDiagram.R"
From Organic Design wiki
m |
m |
||
Line 1: | Line 1: | ||
<pre> | <pre> | ||
# This illustrates a problem with missing values | # This illustrates a problem with missing values | ||
− | |||
p <- 100 | p <- 100 | ||
n <- 3 | n <- 3 | ||
x <- matrix(0, nr=p,nc=n) | x <- matrix(0, nr=p,nc=n) | ||
+ | colnames(x) <- LETTERS[1:3] | ||
set.seed(1) | set.seed(1) | ||
− | + | for(i in 1:n) { | |
− | + | x[,i] <- rbinom(p, 1, 1/10) | |
− | x[, | + | } |
− | |||
vennCounts(x)[7,] | vennCounts(x)[7,] | ||
vennDiagram(x) | vennDiagram(x) | ||
+ | x[4,] | ||
x[4,3] <- NA | x[4,3] <- NA | ||
vennCounts(x)[7,] | vennCounts(x)[7,] | ||
vennDiagram(x) | vennDiagram(x) | ||
+ | |||
</pre> | </pre> |
Revision as of 02:44, 28 May 2007
# This illustrates a problem with missing values p <- 100 n <- 3 x <- matrix(0, nr=p,nc=n) colnames(x) <- LETTERS[1:3] set.seed(1) for(i in 1:n) { x[,i] <- rbinom(p, 1, 1/10) } vennCounts(x)[7,] vennDiagram(x) x[4,] x[4,3] <- NA vennCounts(x)[7,] vennDiagram(x)