我有以下Renjin
Java代码,代码将数据从Java分配到Renjin(2个双数组),创建一个新的数据框,打印并保存为Rdata
,如下所示:
engine.put("adId", adId);
engine.put("LandscapeCurrent", LandscapeCurrent);
engine.eval("df=data.frame(ad_id=adId,LandscapeCurrent=LandscapeCurrent)");
engine.eval("print(df)");
engine.eval("save(df,file='C:/Users/yschellekens.INTRANET/Desktop/Stack overflow/output.Rdata')");
df的标准输出(NetBeans
内):
ad_id LandscapeCurrent
1 20383789401 244770561
2 20763458001 237478641
3 19807565841 231586281
4 20320895121 243414801
5 20923711401 251952681
...
运行Java代码后,当我将数据(df)加载到R中时,我得到一个空的数据框:
load('C:/Users/yschellekens.INTRANET/Desktop/Stack overflow/output.Rdata')
> dput(df)
structure(list(ad_id = numeric(0), LandscapeCurrent = numeric(0)), class = "data.frame", .Names = c("ad_id",
"LandscapeCurrent"), row.names = integer(0))