title: using xts object with lm and rollapply
body: <p>I am using tick data to convert it into minutes interval</p>
  
  <pre><code>test &lt;- to.minutes(x, OHLC=TRUE)
  colnames(test) &lt;- c("Open","High","Low","Close")
  test
  2011-06-07 14:23:00  435  435  435  435   
  2011-06-07 14:26:00  430  435  430  435   
  2011-06-07 14:32:00  435  435  430  430   
  2011-06-07 14:35:00  430  430  430  430 
  str(test)
  
    An ‘xts’ object from 2011-03-10 to 2011-06-08 23:56:00 containing:
    Data: num [1:20426, 1:4] 350 360 375 375 370 ...
   - attr(*, "dimnames")=List of 2
    ..$ : NULL
    ..$ : chr [1:4] "Open" "High" "Low" "Close"
    Indexed by objects of class: [POSIXct,POSIXt] TZ: 
    xts Attributes:  
   NULL
  </code></pre>
  
  <p>now I try to use rollapply as follows:</p>
  
  <pre><code>test1&lt;-rollapply(test, width=20, FUN=function(x) {x$xt &lt;-seq(1-nrow(x),0); lm(Close ~poly(xt,4),x)}, by.column=FALSE, align="right")
  </code></pre>
  
  <p>but that generates</p>
  
  <pre><code>    Error in eval(expr, envir, enclos) : object 'Close' not found
  In addition: Warning message:
  In x$xt &lt;- seq(1 - nrow(x), 0) : Coercing LHS to a list
  </code></pre>