I am utilizing Knitr to compile a pdf document, and as such I am 'knitting' to PDF. As of last night the following lines of code produced the graphics I wanted from Corrplot with no problem. As of this morning I am getting an error - nothing has changed code-wise:
```{r,echo=FALSE,include=TRUE,fig.height=14,fig.width=14}
cor<-cor(data[c(3:7,11,12,14,15:51)])
require(corrplot)
corrplot(cor,type="lower",method="ellipse",tl.cex=1.2,cl.cex=1.2)
```
I am getting the following error:
Error in corrplot(cor, type = "lower", method = "ellipse", tl.cex = 1.2, :
unused arguments (type = "lower", method = "ellipse", tl.cex = 1.2, cl.cex = 1.2)
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> corrplot
Execution halted
When I run this code standalone in R, without using knitr, the code runs no problem and produces the graphic I am looking for. I have used Corrplot numerous times and have never had this problem before. Any insight as to how I can resolve this issue?
I encountered the same issue. The problem is that corrplot() is ambiguous. I.e. there are more than one package that use the function corrplot(). As far as I understand, R tries to pick the one that suits best. In our case, this didn't work out as expected.
Simply tell R which corrplot you mean by writing corrplot::corrplot() to specify that you want the function from the package corrplot.
In general: packagename::functionname() allows you to be explicit about which function to use.
See also R: 2 functions with the same name in 2 different packages