I want to plot overlap between two datasets. My first dataset is: dput(rsid_en_vcf[1:43,]) c("rs782629217", "rs782403204", "rs199529001", "rs147880041", "rs141826009", "rs199826048", "rs200558688", "rs782114919", "rs41304577", "rs200311430", "rs147114528", "rs200635479", "rs41288741", "rs782167952", "rs6560827", "rs200242637", "rs144539776", "rs41305669", "rs41288743", "rs41288743", "rs369736529", "rs148025238", "rs41298226", "rs782272071", "rs9329304", "rs9329305", "rs137895574", "rs142619172", "rs144154384", "rs782777737", "rs782796368", "rs782443786", "rs782246853", "rs150779790", "rs782304204", "rs9329306", "rs144740103", "rs4431953", "rs189892388;rs75953774", "rs61839057", "rs61839058", "rs145405488", "rs782307404")
My second dataset is:
dput(en_Brain_Cortex7[1:10,]) structure(list(RSID1 = c("rs2085346", "rs12765102", "rs11250286", "rs1876899", "rs11250293", "rs4880776", "rs7094850", "rs883660", "rs4880780", "rs4880487")), row.names = c(NA, -10L), class = c("tbl_df", "tbl", "data.frame")) I want to plot a venndiagram with overlap for these two datasets. This is what I did:
venn.diagram(
x = list(rsid_en_vcf,en_Brain_Cortex7),
category.names = c("elasticnet_model","rsid_vcf"),
filename = 'venn_diagramm.png',
output=TRUE
)
But it gives an error:
Error:
! Must subset rows with a valid subscript vector.
i Logical subscripts must match the size of the indexed input.
x Input has size 157608 but subscript !duplicated(x, fromLast = fromLast, ...)
has size 0.
CodePudding user response:
The help page says the input to the x argument should be a list of vectors. Your x
was a vector and a data.frame.
This succeeds:
library(VennDiagram)
venn.diagram(
x = list(rsid_en_vcf,en_Brain_Cortex7$RSID1),
category.names = c("elasticnet_model","rsid_vcf"),
filename = 'venn_diagramm.png',
output=TRUE
)
[1] 1
The image file was of type png but was 36 MB and SO refuses to upload it.
Your image is too large to upload (over 2 MiB).
Changing the resolution to 72 and ht and width to 700 I get: