为什么R无法识别cat_plot命令?

时间:2020-06-09 04:08:13

标签: r plot categorical-data interaction

我之前已经运行过此代码,并且可以正常工作。现在,我需要复制灰度图,但是cat_plot的命令莫名其妙地失败了。

我的分析进行以下基本回归分析:

m1 <- lm(y1 ~ M + E + C + G + G*M + G*E + G*C, data = dat)

模型中的每个变量都是分类变量。以前,我使用以下代码生成带有cat_plot的图形,用于比较两组M = 0和M = 1时的预测结果:G = 0和G =1。

library(jtools)
cat_plot(m1, geom = "bar", interval = TRUE,  pred = M, modx = G, plot.points = FALSE, 
         errorbar.width = .2, int.width =.95,
         int.type = "confidence",
         pred.values = c(0,1),
         line.thickness = 1.2,
         pred.labels = c(0,1),
         modx.labels = c("G = 0", "G = 1"))

尽管以前可行,但现在返回以下错误:

Error in cat_plot(m3, geom = "bar", interval = TRUE, pred = mobilization,  : 
  could not find function "cat_plot"

我需要重新创建原始图,并指定我想要灰度而不是彩色。但是为什么我会收到此错误?我尝试卸载和安装jtools,安装并加载了rlang,然后重新启动R。我什至使用过R的旧版本,来查看某种更新是否会引起麻烦。请告知。

谢谢!

0 个答案:

没有答案