# NOT RUN {
# First fit the euler specification
fit <- euler(c("A" = 1, "B" = 0.4, "C" = 3, "A&B" = 0.2))
# Then plot it
plot(fit)
# Same result as above
euler(c("A" = 1, "B" = 0.4, "C" = 3,
"A&B" = 0.2, "A&C" = 0, "B&C" = 0,
"A&B&C" = 0))
# A euler diagram from a list of sample spaces (the list method)
euler(list(A = c("a", "ab", "ac", "abc"),
B = c("b", "ab", "bc", "abc"),
C = c("c", "ac", "bc", "abc")))
# Using the matrix method
mat <- cbind(A = sample(c(TRUE, TRUE, FALSE), size = 50, replace = TRUE),
B = sample(c(TRUE, FALSE), size = 50, replace = TRUE))
euler(mat)
# Using grouping via the 'by' argument
dat <- data.frame(
A = sample(c(TRUE, FALSE), size = 100, replace = TRUE),
B = sample(c(TRUE, TRUE, FALSE), size = 100, replace = TRUE),
gender = sample(c("Men", "Women"), size = 100, replace = TRUE),
nation = sample(c("Sweden", "Denmark"), size = 100, replace = TRUE)
)
euler(dat[, 1:2], by = dat[, 3:4])
# A set with no perfect solution
euler(c("a" = 3491, "b" = 3409, "c" = 3503,
"a&b" = 120, "a&c" = 114, "b&c" = 132,
"a&b&c" = 50))
# The table method
plot(euler(as.table(apply(Titanic, 2:4, sum))))
# }
Run the code above in your browser using DataLab