jtools 包中的 johnson_neyman 返回未知错误“必须在 CHARSXP 上调用‘getCharCE’”

问题描述

我正在尝试使用 R 中的 johnson_neyman 函数来探测交互,但我遇到了一些奇怪的错误

样本数据集

# A tibble: 6 x 4
# Rowwise: 
  SubID     A     B     C
  <dbl> <dbl> <dbl> <dbl>
1     1    -1    -3  2.83
2     2     1    -2  5.83
3     4     1    -1  5.17
4     5    -1     1  3.67
5     6     0    -3  2   
6     7     4     4  7   
test <- 
structure(list(SubID = c(1,2,4,5,6,7),A= c(-1,1,-1,4),B= c(-3,-2,-3,C = c(2.83333333333333,5.83333333333333,5.16666666666667,3.66666666666667,7)),row.names = c(NA,-6L),groups = structure(list(.rows = structure(list(1L,2L,3L,4L,5L,6L),ptype = integer(0),class = c("vctrs_list_of","vctrs_vctr","list"))),class = c("tbl_df","tbl","data.frame")),class = c("rowwise_df","tbl_df","data.frame"))

运行以下线性回归:

fit <- lm(C ~ A + B + (A * B),test)

然后我尝试使用 johnson-neyman 技术:

johnson_neyman(fit,A,B)

返回以下错误

Error in deparse(substitute(e2)) : 
  'getCharCE' must be called on a CHARSXP
Error during wrapup: 'getCharCE' must be called on a CHARSXP
Error: no more error handlers available (recursive errors?); invoking 'abort' restart

我检查我的数据集中没有任何重音字符(它们都是数字)。有人有任何见解吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)