title: R : How to get a single element in data.table
body: <p>I want to get the first element from data.table</p>
  
  <pre><code>library(data.table)
  dt &lt;- data.table(data.frame(prices=c(1.1,2.4,5.3),
                              dates = c(2011-01-04,2011-01-05,2011-01-03)))
  dt
       date       value
   1: 2011-01-04   1.1
   2: 2011-01-05   2.4
   3: 2011-01-03   5.3
  &gt; dt[1,1]
  [1] 1
  &gt; dt[1]
       date       value
   1: 2011-01-04   1.1
  &gt; dt[1][1]
       date       value
   1: 2011-01-04   1.1
  </code></pre>
  
  <p>I need to get the first date. I'm not sure what i'm missing here :(</p>
  
  <p>Thanks a lot. I was bit confused with the output. </p>
  
  <blockquote>
    <p>dt[1, date]<br>
         [1] 2011-01-04<br>
         Levels: 2011-01-03 2011-01-04 2011-01-05 (any idea what levels mean?)</p>
  </blockquote>
  
  <p>This also works st$date[1]. Implementation is same as data frame. </p>