'How to make ggVennDiagram not count NA values?
I have 4 columns for tissue samples (brain liver kidney heart) I have an output for some changed genes and it looks something like this (NA is empty in the excel file)
brain liver kidney heart
gene1 NA gene1 NA
gene2 NA NA NA
NA gene3 NA NA
I'm trying to put a venn diagram together and I found R was counting NA as a value and because they being counted in the overlapping area. Is there a way for R to ignore it while making the venn diagram? Like the total reading is 20 on a tissue and then on the venn diagram overlapping area it has 21 in the circle.
Solution 1:[1]
It sounds like they may be strings and not actual NA values.
Maybe try something like:
SomeVector <- c("NA", NA, "Gene1") ## Create a vector of values
SomeVector[which(SomeVector=="NA")] <- NA ## Replace string with actual NA
SomeVector <- SomeVector[!is.na(SomeVector)] ## Remove NA values
Then put the vectors in a list and call ggVennDiagram. You may also want to wrap the vectors in unique() if there is duplication.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | alexrai93 |
