Question: Need help with creating a Euler diagram from a csv file
0
gravatar for stoessel
4.8 years ago by
stoessel0
Germany
stoessel0 wrote:

Hello, I'm pretty new in the R community and I would like to learn how to make a euler diagram (venn diagram) in R. I would like to read the data from a csv and process the data by rows, for example row 1-3 are the three different groups I would like to compare. It would be great to get a euler diagram with the name, number of elements and also element dependent sizes of the circles. Could somebody please help me with setting up such a script? It would be really helpful to learn how to read certain csv files and also how to set up a nice venn diagram.

Thanks

Daniel

R • 1.8k views
ADD COMMENTlink modified 4.7 years ago by brennanpincardiff200 • written 4.8 years ago by stoessel0
2

Have a look at the VennDiagram package and let us know if you have trouble with that.

ADD REPLYlink written 4.8 years ago by Devon Ryan94k
0
gravatar for brennanpincardiff
4.7 years ago by
United Kingdom
brennanpincardiff200 wrote:

The VennDiagram package is very useful for making and preparing VennDiagrams but you have to know the values of the overlaps. It will make Venn and Euler Diagrams. 

To calculate the overlaps between your groups you can download other packages but it's actually pretty simple with normal R code. 

The intersect() function will give you the number of elements that are the same in two vectors. 

The setdiff() function will give you the number of elements in one vector but not the other. 

These are all detailed in the Set Operation page and there is a useful StackOverload answer too. 

So the basic script you need to write has the following elements:

(1) Read in the csv file - function - read.csv()

(2) Turn your data into three vectors - function - as.vector() 

(3) Compare your sets using the intersect() and setdiff() functions. 

(4) Draw your Venn or Euler diagram with the VennDiagram package

 

If you want to use a package to give you the overlaps from the lists you can try gplots (http://cran.r-project.org/web/packages/gplots/vignettes/venn.pdf).

I have written a script about comparing two protein lists that is a simplified version of what you're trying to do.

I hope this helps. Good luck, P

ADD COMMENTlink modified 4.7 years ago • written 4.7 years ago by brennanpincardiff200
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1006 users visited in the last hour