Difference between revisions of "VennDiagram.R"
From Organic Design wiki
(New page: # This illustrates a problem with missing values library(limma) p <- 100 n <- 3 x <- matrix(0, nr=p,nc=n) set.seed(1) x[,1] <- rbinom(p, 1, 1/10) x[,2] <- rbinom(p, 1, 1/10) x[,3] <- rbi...) |
(Code update) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <pre> | ||
# This illustrates a problem with missing values | # This illustrates a problem with missing values | ||
+ | library(limma) | ||
+ | |||
+ | graphics.off() | ||
− | |||
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[, | + | x[,i] <- rbinom(p, 1, 1/10) |
− | x | + | } |
− | x | + | |
+ | # Two copies one containing missing information | ||
+ | x.NA <- x | ||
− | |||
vennDiagram(x) | vennDiagram(x) | ||
+ | title("Simulated venn diagram without missing values") | ||
+ | |||
+ | x[4,] | ||
+ | x.NA[4,3] <- NA | ||
+ | |||
− | x | + | X11() |
+ | vennDiagram(x.NA) | ||
+ | title("Simulated venn diagram with missing values") | ||
+ | # Printing output from A:B intersection | ||
vennCounts(x)[7,] | vennCounts(x)[7,] | ||
− | + | vennCounts(x.NA)[7,] | |
+ | # Note missing value in row 7 has reduced the venn diagram count | ||
+ | # This removes all information about that observation even though we know that | ||
+ | # there was valid information about A and B in row 7, so that information had | ||
+ | # to of been either a A:B interaction or an A:B:C interaction | ||
+ | </pre> |
Latest revision as of 21:44, 6 August 2007
# This illustrates a problem with missing values library(limma) graphics.off() 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) } # Two copies one containing missing information x.NA <- x vennDiagram(x) title("Simulated venn diagram without missing values") x[4,] x.NA[4,3] <- NA X11() vennDiagram(x.NA) title("Simulated venn diagram with missing values") # Printing output from A:B intersection vennCounts(x)[7,] vennCounts(x.NA)[7,] # Note missing value in row 7 has reduced the venn diagram count # This removes all information about that observation even though we know that # there was valid information about A and B in row 7, so that information had # to of been either a A:B interaction or an A:B:C interaction