A Venn diagram helps to identify the common and uncommon elements between two or more than two sets of elements. This is also used in probability theory to visually represent the relationship between two or more events. To create a Venn diagram in R, we can make use of venn function of gplots package.
Consider the below vectors
Installing and loading gplots package −
Creating the Venn diagram for x and y −
If we have three variables then we will just add the third variable in venn function as shown below −