3

我有以下RenjinJava代码,代码将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))
4

0 回答 0