微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。