我想panel.lmbands
从mosaic
包中添加。我正在使用以下代码
library(lattice)
library(tidyverse)
library(hydroGOF)
library(mosaic)
library(latticeExtra)
summ <- iris %>%
group_by(Species) %>%
summarise(Rsq = cor(Sepal.Length, Petal.Length)^2,
RMSE = rmse(Sepal.Length, Petal.Length),
NSE = NSE(Sepal.Length, Petal.Length)) %>%
mutate_if(is.numeric, round, digits=2)
summ$ann <- lapply(1:nrow(summ), function(i) with(summ[i, ],
c(bquote(R^2 == .(Rsq)), bquote(RMSE == .(RMSE)), bquote(NSE == .(NSE))))
)
xyplot(Petal.Length ~ Sepal.Length | Species, data = iris, pch = 23,
layout=c(3,1),
band.lty = c(conf =2, pred = 1),
band.lwd =c(conf =1, pred = 1),
npts = 500,
panel = panel.lmbands,
scales=list(cex=c(1.4,1.4), alternating=1, relation = "free"),
xlab = list(label="Sepal Length", fontsize=20),
ylab = list(label="Petal Length", fontsize=20),
panel = function(x, ...) {
i <- panel.number()
panel.xyplot(x, ...)
panel.key(as.expression(summ$ann[[i]]), points = FALSE)
})
它返回我以下错误
xyplot.formula 中的错误(Petal.Length ~ Sepal.Length | Species, data = iris, : 由多个实际参数匹配的形式参数“面板”
我该如何纠正错误?