title: How to assign index or access index of time series objects?
body: <p>My example.</p>
  
  <p>Some data:</p>
  
  <pre><code>  set.seed(1000)
    dates&lt;- seq.Date(as.Date("2013-01-01"), as.Date("2013-01-31"),by='days')
    y &lt;- round(3 * 3 + rnorm(31),1)
    df&lt;- cbind.data.frame(dates, y)
  </code></pre>
  
  <p>Now I would like to access df in order to get the values of <code>y from "2013-01-25" to "2013-01-31"</code>:</p>
  
  <pre><code>  estimtaionPeriod &lt;- as.Date(c("2013-01-25", "2013-01-31"))
    length.estimationPeriod.values &lt;-df$dates[estimtaionPeriod[[1]] : estimtaionPeriod[[2]]]
  </code></pre>
  
  <p>But I get <code>NAs</code>. So I suppose I have to define a time series object:</p>
  
  <pre><code>  library(zoo)
    library(xts)
  
  
    ts &lt;- ts(df$y, start=as.Date("2013-01-01"), end=as.Date("2013-01-31"))
    length.estimationPeriod.values &lt;-ts[estimtaionPeriod[[1]] : estimtaionPeriod[[2]]]
  
  
    ts &lt;- zoo(df$y, order.by = as.Date("2013-01-01"), as.Date("2013-01-31"))
    length.estimationPeriod.values &lt;-ts[estimtaionPeriod[[1]] : estimtaionPeriod[[2]]]
  </code></pre>
  
  <p>However, that was not successful.</p>