So, I keep getting an error when trying to plot Johnson-neyman plots with the sim_slopes
function of the Interactions package.
library(interactions)
m <- lm(mpg ~ hp * wt, data = mtcars)
sim_slopes(m, pred = hp, modx = wt, jnplot = TRUE)
error:
Error:
! `class` must be a character vector, not a list.
Backtrace:
1. interactions::sim_slopes(m, pred = hp, modx = wt, jnplot = TRUE)
3. jtools:::summ.lm(...)
4. jtools:::do_robust(model, robust, cluster, data, vcov)
5. jtools::get_robust_se(...)
6. jtools::stop_wrap(...)
8. rlang (local) `<fn>`(class = <named list>)
Packages versions:
packageVersion('rlang')# [1] ‘1.0.6’
packageVersion('interactions') # ‘1.1.5' .
I tested a few alternatives (RStudio cloud and friends' computers) and it seems like it's a problem with my R. I suspect it's something related to rlang
but cannot fix it (already tried a few things, no success).
Any ideas on how to fix that or what may be causing it?
Thanks in advance!
Well, I figured it out.
After reinstalling and updating all the dependencies for both jtools
and rlang
, the code started to run normally.
I don't know exactly where things started to work, but it seems to have been an issue with the many packages related to either jtools
or rlang