title: Error when doing linear regression using zoo objects ... Error in `$<-.zoo`(`*tmp*`
body: <p>I am new to R and slowly getting acquainted.  My question refers to the following piece of code.</p>
  <p>I am creating a zoo object with the following headers and then filtering by date.  On the filtered dates I am subtracting two columns (Tom from Elena).  Everything works fine until here.</p>
  <p>Code below:</p>
  <blockquote>
  <p>b &lt;- read.zoo(b1, header = TRUE, index.column = 1, format = &quot;%d/%m/%Y&quot;)</p>
  <p>startDate = &quot;2013/11/02&quot;
  endDate = &quot;2013/12/20&quot;</p>
  <p>dates &lt;- seq(as.Date(startDate), as.Date(endDate), by=1)</p>
  <p>TE = b[dates]$Tom - b[dates]$Elena</p>
  </blockquote>
  <p>However I am then regressing the results from my subtraction (see above TE) on Elena.  However i get an error message every time i try and to this regression</p>
  <blockquote>
  <p>TE$model &lt;- lm(TE ~ b[dates]$Elena)</p>
  </blockquote>
  <p>Error in <code>$&lt;-.zoo</code>(<code>*tmp*</code>, &quot;model&quot;, value = list(coefficients = c(-0.0597128230859905,  :
  not possible for univariate zoo series</p>
  <p>I have tried creating a data frame and then doing the regression but with no avail.  Any help would be appreciated. Thanks.</p>