我想使用R中的VennDiagram库在Venn图的每个圆圈的标签中写入元素总数。
假设我有两个数据帧(第一列是行名)。
Df1
C1_01740W_A 71.69347 1.818192 0.46667755 3.896036 9.777989e-05 8.451075e-04
C1_02340C_A 68.04825 2.434093 0.39890494 6.101938 1.047900e-09 3.557006e-08
C1_02690C_A 47.80261 3.086803 0.56129955 5.499386 3.811158e-08 8.872260e-07
C1_04010C_A 306.35146 1.920717 0.18041009 10.646393 1.812521e-26 5.005852e-24
C1_04500W_A 2063.92967 1.827202 0.09031012 20.232532 5.063494e-91 3.076579e-87
Df2
C1_11340W_A 48.13831 2.201762 0.5518875 3.989512 6.620927e-05 2.376874e-03
C3_04730C_A 26.54770 2.610197 0.8984530 2.905213 3.670030e-03 4.236766e-02
C5_04250W_A 36.58761 1.827967 0.5389795 3.391533 6.950268e-04 1.315691e-02
C7_02260W_A 176.95500 1.999881 0.2953266 6.771758 1.272266e-11 7.718838e-09
CR_08750C_A 50.61426 1.693394 0.5274584 3.210479 1.325139e-03 2.061440e-02
我尝试过的是:
venn.diagram(list(as.character(paste0("Df1 (n=", eval(parse(text="nrow(Df1)")),")"))=row.names(Df1),
as.character(paste0("Df2 (n=", eval(parse(text="nrow(Df2)")),")"))=row.names(Df2)),
fill=c("red", "blue"), height = 5000, width = 5000, resolution = 2000,
main = "Title",
filename="filename.png",
imagetype = "png")
但它不起作用,并显示错误:
错误:“ venn.diagram(list(as.character(paste0(” Df1 (n =“,eval(parse(text =” nrow(Df1)“)),”)“))=
但是,as.character(paste0("Df1 (n=", eval(parse(text="nrow(Df1)")),")"))
部分实际上产生了我需要的标签。
非常感谢任何建议,