R 错误“element_line 错误(colour = text_and_line_color,linewidth = 0.5,linetype = 1,:未使用的参数(linewidth = 0.5)”

问题描述 投票:0回答:0

我在 R 中使用交互包,在运行绘图函数(cat_plot、interact_plot)时不断出现错误。看起来这可能是 ggplot2 更新的问题,但我的知识还不足以解决这个问题。

我在运行 R 文档提供的示例代码时遇到了同样的错误,所以我将包括:

library(interactions)
mpg2 <- mpg
mpg2$auto <- "auto"
mpg2$auto[mpg2$trans %in% c("manual(m5)", "manual(m6)")] <- "manual"
mpg2$auto <- factor(mpg2$auto)
mpg2$fwd <- "2wd"
mpg2$fwd[mpg2$drv == "4"] <- "4wd"
mpg2$fwd <- factor(mpg2$fwd)
## Drop the two cars with 5 cylinders (rest are 4, 6, or 8)
mpg2 <- mpg2[mpg2$cyl != "5",]
mpg2$cyl <- factor(mpg2$cyl)
## Fit the model
fit3 <- lm(cty ~ cyl * fwd * auto, data = mpg2)

# The line geom looks good for an ordered factor predictor
cat_plot(fit3, pred = cyl, modx = fwd, mod2 = auto, geom = "line",
 interval = TRUE)

cat_plot 应返回模型输出图,但我收到此错误消息: element_line 错误(colour = text_and_line_color,linewidth = 0.5,linetype = 1,: 未使用的参数(线宽 = 0.5)

有人知道如何解决这个问题吗?

r ggplot2 r-package
© www.soinside.com 2019 - 2024. All rights reserved.