Load data using RCaller

113 Views Asked by At

I want to load data which is embedded in an R package. I use GWmodel package and want to load LondonHP data. But when i try to load the data using RCaller in Java, the xml return is :

<?xml version="1.0"?> <root> </root>

This is my code to load the data :

code.R_require("GWmodel"); code.addRCode("data(LondonHP)"); caller.setRCode(code); caller.runAndReturnResult("londonhp");

Can you guys give me solution to my problem?

1

There are 1 best solutions below

0
On BEST ANSWER

We can see in R console that the londonhp object is in type of S4 :

> typeof(londonhp)
[1] "S4"

So, it has some slots :

> slotNames(londonhp)
[1] "data"        "coords.nrs"  "coords"      "bbox"        "proj4string"

You can access its elements using the @ operator:

> londonhp@data

So you need to handle londonhp@data, not londonhp itself.