title: Replacing column values with a POSIXlt object
body: <p>Consider the following R code which replaces the values in one column of a data frame with a set of POSIXct values:</p>
  
  <pre><code>foo &lt;- as.data.frame(list(bar=rep(5,5)))
  bar &lt;- as.POSIXct(rep(5,5), origin="1970-1-1", tz="c")
  foo[,1] &lt;- bar
  </code></pre>
  
  <p>My question: why does the same operation fail when I try to use POSIXlt instead? For example:</p>
  
  <pre><code>foo &lt;- as.data.frame(list(bar=rep(5,5)))
  bar &lt;- as.POSIXlt(rep(5,5), origin="1970-1-1", tz="c")
  foo[,1] &lt;- bar
  Warning message:
     In `[&lt;-.data.frame`(`*tmp*`, , 1, value = list(sec = c(5, 5, 5,  :
     provided 9 variables to replace 1 variables
  </code></pre>
  
  <p>Moreover, if I refer to the column by name, instead of by index, the same assignment works just fine:</p>
  
  <pre><code>foo$bar &lt;- bar
  foo &lt;- as.data.frame(list(bar=rep(5,5)))
  bar &lt;- as.POSIXlt(rep(5,5), origin="1970-1-1", tz="c")
  foo$bar &lt;- bar
  </code></pre>
  
  <p>What am I missing?</p>