Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取错误:";“形式论证”;标签.pos";由多个实际参数匹配”;在plotrix::polar.plot中_R_Plot_Plotrix - Fatal编程技术网

获取错误:";“形式论证”;标签.pos";由多个实际参数匹配”;在plotrix::polar.plot中

获取错误:";“形式论证”;标签.pos";由多个实际参数匹配”;在plotrix::polar.plot中,r,plot,plotrix,R,Plot,Plotrix,我正在绘制轴承方向的径向图,它给出了label.pos参数的错误 polar.plot(bear[,2],bear[,1],main="Distribution of Start Points from centre", rp.type="r",labels=c("North","West","South","East"), label.pos=c(90,180,270,0), clockwise=FALSE, radial.labels = "",

我正在绘制轴承方向的径向图,它给出了label.pos参数的错误

  polar.plot(bear[,2],bear[,1],main="Distribution of Start Points from centre",
                   rp.type="r",labels=c("North","West","South","East"),
label.pos=c(90,180,270,0), 
 clockwise=FALSE, radial.labels = "",
               label.pos=NULL, line.col=c("yellow"),show.radial.grid=FALSE,
               show.grid.labels=1,
               radial.lim=c(0,max(bear[,2]),
                            boxed.radial=FALSE)) 
这给了我一个错误的说法

Error in polar.plot(bear[, 2], bear[, 1], main = "Distribution of Start Points from centre",  : 
  formal argument "label.pos" matched by multiple actual arguments

如何更改参数以获得绘图上的方向?

上述错误可以在以下两种情况下看到:

在函数中,只能使用参数名称的一部分,函数将正常工作。让我们看一个例子:

myfun<-function(ab,aa){
  ab*aa
}
R能够理解,因为第一个命名参数是
ab
,第二个以
a
开头,所以第二个参数实际上是
aa

但是,如果我尝试以下操作,它将不起作用:

> myfun(a=5,a=4)
Error in myfun(a = 5, a = 4) : 
  formal argument "ab" matched by multiple actual arguments
在上述情况下,R不知道哪个
a
对应于
ab
,哪个对应于
aa
,因此您得到的错误与您在问题中提到的错误相同

如果两次提供相同的(正确命名的)参数,则会出现相同的错误:

> myfun(aa=5,aa=4)
Error in myfun(aa = 5, aa = 4) : 
  formal argument "aa" matched by multiple actual arguments

您已经两次传递了
label.pos
参数,因此出现了错误。
> myfun(aa=5,aa=4)
Error in myfun(aa = 5, aa = 4) : 
  formal argument "aa" matched by multiple actual arguments