title: Get same output as R console in Java using JRI
body: <p>When I enter the following commands directly into the R console</p>
  
  <pre><code>library("xts")
  mySeries &lt;- xts(c(1.0, 2.0, 3.0, 5.0, 6.0), order.by=c(ISOdatetime(2001, 1, 1, 0, 0, 0), ISOdatetime(2001, 1, 2, 0, 0, 0), ISOdatetime(2001, 1, 3, 0, 0, 0), ISOdatetime(2001, 1, 4, 0, 0, 0), ISOdatetime(2001, 1, 5, 0, 0, 0)))
  resultingSeries &lt;- to.monthly(mySeries)
  resultingSeries 
  </code></pre>
  
  <p>I will get an output like this</p>
  
  <pre><code>             mySeries.Open mySeries.High mySeries.Low mySeries.Close
  Jan 2001             1             6            1              6
  </code></pre>
  
  <p>When I look into the attributes, I see the following output</p>
  
  <pre><code>attributes(resultingSeries)
  
  $dim
  [1] 1 4
  
  $dimnames
  $dimnames[[1]]
  NULL
  
  $dimnames[[2]]
  [1] "mySeries.Open"  "mySeries.High"  "mySeries.Low"   "mySeries.Close"
  $index
  [1] 978307200
  attr(,"tclass")
  [1] "yearmon"
  $tclass
  [1] "POSIXct" "POSIXt" 
  $tzone
  [1] ""
  $class
  [1] "xts" "zoo"
  $.indexCLASS
  [1] "yearmon"
  </code></pre>
  
  <p>This is the same I get in Java. I'm wondering where the magic happens so that I see the nice output I get in R. I have no access to the event loop, since I'm using JRI like this (since, it's the recommended way and simplifies error handling):</p>
  
  <pre><code>REngine engine = REngine.engineForClass("org.rosuda.REngine.JRI.JRIEngine");
  REXP result = engine.parseAndEval(...)
  </code></pre>
  
  <p>/edit
  In Java I execute each command from above as follows:</p>
  
  <pre><code>REXP result = engine.parseAndEval("resultingSeries") // or any other command
  </code></pre>
  
  <p>What I get is</p>
  
  <pre><code>org.rosuda.REngine.REXPDouble@4ac66122+[12]
  </code></pre>
  
  <p>The payload being doubles: 1, 6, 1, 6
  The attributes are the same as specified above.</p>
  
  <p>Now R does some magic to display the output above. Is there a way I can get the same output without having to create it manually by myself? Where's the implementation stored, that R gets the above mentioned output?</p>