Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
367 views
in Technique[技术] by (71.8m points)

r - johnson_neyman from jtools package returning an unknown error "'getCharCE' must be called on a CHARSXP"

I am trying to use the johnson_neyman function in R to probe an interaction, but I am getting some weird errors.

Sample dataset

# 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, -1, 0, 4), B= c(-3, -2, -1, 1, -3, 4), 
C = c(2.83333333333333, 5.83333333333333, 5.16666666666667, 3.66666666666667, 2, 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"))), row.names = c(NA, -6L), 
class = c("tbl_df", "tbl", "data.frame")), class = c("rowwise_df", "tbl_df", "tbl", "data.frame"))

Ran the following linear regression:

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

Then my attempt at using the johnson-neyman technique:

johnson_neyman(fit, A, B)

Which returns the following errors:

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

I check that I don't have any accented characters in my dataset (they're all numbers). Anyone have any insights?

question from:https://stackoverflow.com/questions/65843495/johnson-neyman-from-jtools-package-returning-an-unknown-error-getcharce-must

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...