I struggling to draw a simple Venn diagram, and I'm getting errors that I do not understand.
I cannot work out what is wrong in my codes (below) compared to the one written in the Rdocumentation for the draw.triple.venn diagram function - the code is fine in my opinion (https://www.rdocumentation.org/packages/VennDiagram/versions/1.6.20/topics/draw.triple.venn).
library(VennDiagram)
library(gridExtra)
body(draw.triple.venn)[[78]] <- substitute(cell.labels <- paste0(areas," : ", round( 100*areas/sum(areas), 1), "%"))
# this line of code adds %s to each of the cells in the Venn Diagram
g <- draw.triple.venn(
area1 = 2951,
area2 = 2764,
area3 = 2764,
n12 = 719,
n23 = 807,
n13 = 1034,
n123 = 325,
category = c("Mental Health", "Community", "Social Care"),
fill = c("blue", "red", "green"),
cat.col = c("blue", "red", "green"),
lty = "blank",
euler.d = TRUE,
scaled = TRUE,
cex = 2,
cat.cex = 2);
grid.arrange(gTree(children = g), main = "Breakdown of WSIC Service Users", sub = "By table")
The error message that I get, and cannot work out what it means is:
Error in if (max.x - min.x >= max.y - min.y) { :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In sqrt(r1^2 - (l.x.cept.13 - x.centres[1])^2) : NaNs produced
2: In sqrt(r1^2 - (l.x.cept.13 - x.centres[1])^2) : NaNs produced
Thank you!