title: Display row names in a data.table object
body: <p>Reference: While trying to answer <a href="https://stackoverflow.com/questions/24198629/how-to-create-summaries-of-subgroups-based-on-factors-in-r/24199211#24199211">this very basic question</a>, I suddenly realized that I wasn't able to display <code>rownames</code> in a <code>data.table</code> object</p>
  
  <p>Toy example</p>
  
  <pre><code>library(data.table)
  DT &lt;- data.table(A = letters[1:3])
  DT
  ##    A
  ## 1: a
  ## 2: b
  ## 3: c
  row.names(DT) &lt;- 4:6
  row.names(DT)
  ## [1] "4" "5" "6" # seem to work
  </code></pre>
  
  <p>or</p>
  
  <pre><code>rownames(DT) &lt;- 7:9
  rownames(DT)
  ## [1] "7" "8" "9" # seems to be ok too
  </code></pre>
  
  <p>But when displaying the data itself, row names remains unchanged</p>
  
  <pre><code>DT
  ##    A
  ## 1: a
  ## 2: b
  ## 3: c
  </code></pre>
  
  <p>I would assume <code>data.table</code> ignores unnecessary attributes for efficiency purposes, but <code>attributes</code> seem to disagree</p>
  
  <pre><code>attributes(DT)
  # $names
  # [1] "A"
  # 
  # $row.names
  # [1] 7 8 9
  # 
  # $class
  # [1] "data.table" "data.frame"
  # 
  # $.internal.selfref
  # &lt;pointer: 0x0000000000200788&gt;
  </code></pre>