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

Sarah Goslee sarah.goslee at gmail.com
Tue Jul 29 22:07:59 CEST 2014


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


On Tue, Jul 29, 2014 at 11:11 AM, Fix Ace <acefix at rocketmail.com> wrote:
> 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
http://www.functionaldiversity.org



More information about the R-help mailing list