I am plotting a radial plot of bearing directions and it gives an error with label.pos argument
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))
It gives me an error saying
Error in polar.plot(bear[, 2], bear[, 1], main = "Distribution of Start Points from centre", :
formal argument "label.pos" matched by multiple actual arguments
How do I change the argument to get the direction on the plot ?
The above error can be seen in two occasions which I describe below:
In functions one can use only part of the name of an argument and the function will work. Let's see an example:
myfun<-function(ab,aa){
ab*aa
}
Notice that passing one of the arguments as ab
and the other one as simple a
will work.
> myfun(ab=5, a=4)
[1] 20
R is able to understand that since the first named argument is ab
and the second starts with a
, that the second argument is actually aa
.
However, if I try the following it will not work:
> myfun(a=5,a=4)
Error in myfun(a = 5, a = 4) :
formal argument "ab" matched by multiple actual arguments
In the above case R does not know which a
corresponds to ab
and which to aa
and thus you get an error same as the one you mention in your question.
The same error appears if you provide the same (correctly named) argument twice:
> myfun(aa=5,aa=4)
Error in myfun(aa = 5, aa = 4) :
formal argument "aa" matched by multiple actual arguments
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.