gpt4 book ai didi

r - 错误: Argument 20 matches multiple formal arguments in venn.diagram function

转载 作者:行者123 更新时间:2023-12-03 08:09:36 27 4
gpt4 key购买 nike

我是venn.diagram()函数的新手,正在尝试创建一个简单的维恩图。这是我正在使用的数据:

structure(list(Transmitter = c("1657", "1657", "1658", "1659", 
"1659", "1660", "1660", "1661", "1662", "1663", "1663", "1664",
"1664", "1666", "1667", "1667", "1668", "1668", "1669", "1670",
"1671", "1671", "1672", "1672", "1673", "1673", "1674", "1674",
"1675", "1675", "1676", "1676", "1678", "1679", "1679", "1680",
"1681", "1681", "1682", "1682", "1683", "1684", "1685", "1686",
"1686", "9782", "9782", "24166", "24166", "24167", "24168", "24169",
"24170", "24171", "24172", "24173", "24174", "24175", "24175",
"24176", "24177", "24178", "24179", "24179", "24180", "24181",
"24182", "24183", "24184", "24184", "24185", "24186", "24187",
"24188", "24189", "24190", "24191", "24192", "24193", "24194",
"24194", "24195", "24195", "24196", "24197", "24198", "24198",
"24199", "24199", "24200", "24201", "24203", "24204", "24204",
"24206", "24207", "24209", "24210", "24211", "24212", "24212",
"24213", "24214", "24215", "24216", "24216", "24217", "24218",
"24219", "30759", "30760", "30761", "30761", "30761", "30762",
"30763", "30764", "30765", "30765", "30765", "30766", "30766",
"30766", "30767", "30767", "30768", "30768", "30768", "30769",
"30769", "30769", "30770", "30771", "30772", "30772", "30772",
"30773", "30773", "30773", "30774", "30774", "30775", "30775",
"30776", "30776", "30777", "30777", "30777", "30778", "30778",
"30779", "30780", "30780", "30780", "30781", "30782", "30782",
"30783", "30784", "30785", "30786", "30787", "30788", "30788"
), Direction = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 2L,
1L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 2L,
2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 2L), .Label = c("Marine",
"River"), class = "factor")), row.names = c(NA, -164L), class = "data.frame")

我想为每个方向创建一个带有圆圈的维恩图。在每个圆圈内有一个数字,指示被视为“河”,“海”或两者的发射机的数量。

这是我从网站修改的一些代码:
install.packages('VennDiagram')
library(VennDiagram)

venn.diagram(
x = list(
lasts2WOFD %>% filter(Direction == 'Marine') %>% select(Transmitter) %>% unlist() ,
lasts2WOFD %>% filter(Direction == 'River') %>% select(Transmitter) %>% unlist()
),
category.names = c("Marine" , "Fresh"),
filename = 'VennDiagram',
output = TRUE ,
imagetype="png" ,
height = 480 ,
width = 480 ,
resolution = 300,
compression = "lzw",
lwd = 1,
col=c("#440154ff", '#21908dff'),
fill = c(alpha("#440154ff",0.3), alpha('#21908dff',0.3)),
cex = 0.5,
fontfamily = "sans",
cat.cex = 0.3,
cat.default.pos = "outer",
cat.pos = c(-27, 27),
cat.dist = c(0.055, 0.055),
cat.fontfamily = "sans",
cat.col = c("#440154ff", '#21908dff'),
rotation = 1
)

运行时,出现此错误:
Error in VennDiagram::draw.pairwise.venn(area1 = length(x[[1]]), area2 = length(x[[2]]),  : 
argument 20 matches multiple formal arguments

最佳答案

关于您的问题,我看了看VennDiagram的源代码,发现rotationvenn.diagram的一部分,但不是draw.pairwise.venn的一部分。该参数已传递但无法使用。只需删除rotation=1,它就可以工作。

关于r - 错误: Argument 20 matches multiple formal arguments in venn.diagram function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61484918/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com