Skip to content

Instantly share code, notes, and snippets.

@larseggert
Last active August 30, 2021 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larseggert/6bb5284716bb2b3f0f9bd8f09fcb1617 to your computer and use it in GitHub Desktop.
Save larseggert/6bb5284716bb2b3f0f9bd8f09fcb1617 to your computer and use it in GitHub Desktop.
#! /usr/bin/env Rscript
if (!require("pacman"))
install.packages("pacman", repos = "https://cloud.r-project.org/")
pacman::p_load(eulerr)
# See https://cran.r-project.org/web/packages/eulerr/vignettes/introduction.html
# for an intro to eulerr
before_disqual <- c( # From Robert:
A = 958, # Path 1 : 922
B = 255, # Path 2 : 238
C = 675, # Path 3 : 649
"A&B" = 209, # Paths 1 and 2 : 192
"B&C" = 160, # Paths 2 and 3 : 146
"A&C" = 303, # Paths 1 and 3 : 277
"A&B&C" = 136, # Paths 1, 2, and 3 : 122
D = 125, # Volunteers : 116
"A&D" = 114, # Volunteers and path 1 : 113
"B&D" = 50, # Volunteers and path 2 : 50
"C&D" = 63, # Volunteers and path 3 : 62
"A&B&D" = 49, # Volunteers and paths 1 and 2 : 49
"B&C&D" = 37, # Volunteers and paths 2 and 3 : 37
"A&C&D" = 60, # Volunteers and paths 1 and 3 : 59
"A&B&C&D" = 36 # Volunteers and paths 1, 2, and 3 : 36
)
after_disqual <- c( # From Robert:
A = 922, # Path 1 : 922
B = 238, # Path 2 : 238
C = 649, # Path 3 : 649
"A&B" = 192, # Paths 1 and 2 : 192
"B&C" = 146, # Paths 2 and 3 : 146
"A&C" = 277, # Paths 1 and 3 : 277
"A&B&C" = 122, # Paths 1, 2, and 3 : 122
D = 116, # Volunteers : 116
"A&D" = 113, # Volunteers and path 1 : 113
"B&D" = 50, # Volunteers and path 2 : 50
"C&D" = 62, # Volunteers and path 3 : 62
"A&B&D" = 49, # Volunteers and paths 1 and 2 : 49
"B&C&D" = 37, # Volunteers and paths 2 and 3 : 37
"A&C&D" = 59, # Volunteers and paths 1 and 3 : 59
"A&B&C&D" = 36 # Volunteers and paths 1, 2, and 3 : 36
)
plot_euler <- function(data) {
fit <- euler(data, input="union", shape="ellipse",
control=list(extraopt=TRUE, extraopt_threshold=0.0001)
)
print(fit)
plot(fit, quantities = TRUE,
labels = c("Path 1", "Path 2", "Path 3", "Volunteers")
)
}
# plot_euler(before_disqual)
plot_euler(after_disqual)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment