title: How do I get a prop.table in data.table?
body: <p>I've been looking at a question that is wrongly tagged as <code>data.table</code>. Here: <a href="https://stackoverflow.com/questions/26454499/prop-table-error-in-r">prop.table() error in r</a> 
  I'm looking to get a proportions table but I've so far done so with no luck. Here is sample data and code:</p>
  
  <pre><code>library(data.table)
  data(Arthritis,package="vcd")
  #mytable&lt;-with(Arthritis,table(Improved))
  #mytable
  mydata2&lt;-copy(Arthritis)
  setDT(mydata2)
  head(mydata2)
  mydata2[,.(.N),by=.(Improved)]
  mydata2[,lapply(.N,sum),by=.(Improved)]
  </code></pre>
  
  <p>This yields:</p>
  
  <pre><code>   Improved V1
  1:     Some 14
  2:     None 42
  3:   Marked 28
  </code></pre>
  
  <p>I thought simply chaining like this would help but it returns interesting output:</p>
  
  <pre><code>mydata2[,lapply(.N,sum),by=.(Improved)][,prop:=V1/sum(V1)]
  </code></pre>
  
  <p>What is a simple exclusively <code>data.table</code> way to get a proportions table?</p>