【发布时间】:2015-04-03 08:51:09
【问题描述】:
我正在使用 JRI 包来构建一个使用 catR 包的应用程序。在我的 Mac 上完美运行,但是当我在 Windows 上尝试时,函数 thetaEst 总是返回 null - 只有这个函数。是否有任何特定于 Windows 的配置..?
这是一段代码:
re.eval("ibsize <- 38");
re.eval("responses <- c(" + resp + ")");
re.eval("discrimination <- sample(1, ibsize, replace=T)");
re.eval("difficulty <- c(3.64, 2.42, 2.16, 2.42, 1.64, 1.51, 1.16, -0.95, 1.40, -0.90, 0.31, 1.17, 0.63, 1.22, -0.74, -0.71, -0.74, -0.66, -0.79, 0.03, 1.60, 0.26, -0.15, 1.81, 1.17, 0.50, -0.04, 1.93, 0.97, -0.04, 3.44, 0.23, 0.05, 3.64, 1.47, 2.08, 3.34, 1.00)");
re.eval("guessing <- sample(0, ibsize, replace=T)");
re.eval("inattention <- sample(1, ibsize, replace=T)");
re.eval("itemBank <- cbind(discrimination, difficulty, guessing, inattention)");
REXP theta = re.eval("thetaEst(itemBank, responses, method = \"EAP\", parInt = c(-3.64, 3.64, 99))");
System.out.println("theta = "+ theta.asDouble());
我在 theta.asDouble() 上遇到 NullPointerException;
谁能帮帮我?
提前致谢。
【问题讨论】:
-
看起来 theta 为空。如果您使用与您的 mac 相同的代码,您可能没有安装/引用包来实例化 REXP theta 变量。
-
你是对的,theta 为空。但是所有的包都被安装/引用了,因为同一个包中的其他功能可以完美运行——比如 nextItem()、semTheta()...
-
您确定正确使用 thetaEst 吗?能否请您显示 R 输出,仅在 R 控制台中运行?,好像我无法激活它。
-
能否也显示所有Java Main 类的内容?包括 re.assign 语句?
标签: java r nullpointerexception jri