我发现当所有值都相同时, lm 函数会引发错误。但它适用于 GNU R。我使用的是最新的renjin-script-engine-0.8.1593.jar
.
抛出任何异常:
Caused by: org.renjin.eval.EvalException: contrasts can be applied only to factors with 2 or more levels
at org.renjin.primitives.Conditions.stop(Conditions.java:193)
at org.renjin.primitives.R$primitive$stop.doApply(R$primitive$stop.java:72)"
当我用这个脚本调用 RenjinScriptEngine.eval(..) 时:
fit<-lm("formula"=vals~index,"data"=data)
输入的数据是
"2015-36",9
"2015-37",9
"2015-41",9.