[R] venn.diagram, error message: Incorrect number of elements

1,011 views
Skip to first unread message

Fix Ace

unread,
Jul 29, 2014, 11:33:20 AM7/29/14
to r-h...@r-project.org
Hello, there,
I have 6 dataset and trying to draw a venn.diagram using R VennDiagram package, but got this error message. Could anybody figure out why?

Thanks
===
> library(VennDiagram)
Loading required package: grid

> head(A)
               V1
1 F_HO10000
2 F_HO10001
3 F_HO10002
4 F_HO10003
5 F_HO10004
6 F_HO10005
> head(B)
               V1
1  F_HO1000
2 F_HO10000
3 F_HO10001
4 F_HO10002
5 F_HO10003
6 F_HO10004
> head(C)
               V1
1 F_HO10000
2 F_HO10001
3 F_HO10002
4 F_HO10003
5 F_HO10004
6 F_HO10005
> head(D)
               V1
1  F_HO1000
2 F_HO10000
3 F_HO10001
4 F_HO10002
5 F_HO10003
6 F_HO10004
> head(E)
               V1
1 F_HO10001
2 F_HO10002
3 F_HO10004
4 F_HO10007
5 F_HO10008
6 F_HO10009
> head(F)
               V1
1  F_HO1000
2 F_HO10000
3 F_HO10001
4 F_HO10002
5 F_HO10003
6 F_HO10004
> venn.diagram(x=list(A=A[,1], B=B[,1], C=C[,1], D=D[,1], E=E[,1], F=F[,1]), filename="Venn-6.test.tiff", col="transparent", alpha=0.5, fill=c("dodgerblue","goldenrod1","darkorange1","seagreen3","orchid3", "green"), margin=0.2)
Error: Incorrect number of elements.
>

[[alternative HTML version deleted]]

Sarah Goslee

unread,
Jul 29, 2014, 4:22:18 PM7/29/14
to Fix Ace, r-h...@r-project.org
The venn.diagram() function in the package VennDiagram only works with
sizes up to 5.

That isn't horribly clear from the help file, but quite explicit in the code:

if (0 == length(x) | length(x) > 5) {
stop("Incorrect number of elements.", call. = FALSE)
}

If you really need 6, you could presumably look at the way that
venn.diagram() works and add in your own 6-handling code.

Sarah
--
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
R-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Fix Ace

unread,
Jul 30, 2014, 3:16:20 AM7/30/14
to Sarah Goslee, r-h...@r-project.org
Thanks!
[[alternative HTML version deleted]]

Reply all
Reply to author
Forward
0 new messages