title: How to get proportions in R using table function?
body: <p>I have a crime dataset having few variables as (ID,Year,Date,Arrest) , now I am trying to get the proportion of Arrests made in a particular year for example for years say (2001,2010,2015) how can I calculate it by using table function?</p>
  
  <p>I tried using below code, but it doesn't give a decent outcome :</p>
  
  <pre><code>prop.table(table(CRDATA$Year,CRDATA$Arrest))
  </code></pre>
  
  <p>and </p>
  
  <pre><code>prop.test(table(CRDATA$Year,CRDATA$Arrest))
  </code></pre>
  
  <p>Note: dataset name is CRDATA, Year is of Date type and Arrest is of Logi datatype</p>
  
  <p>Below is a portion of dataset</p>
  
  <pre><code>ID      Date           Location Arrest  Area    Year
  8951354 12/31/12 23:15  STREET  FALSE   69  2012
  8951141 12/31/12 22:00  STREET  FALSE   24  2012
  8952745 12/31/12 22:00  YARD    FALSE   11  2012
  8952223 12/31/12 22:00  STREET  FALSE   67  2012
  8951608 12/31/12 21:30  STREET  FALSE   35  2012
  8950793 12/31/12 20:30  STREET  TRUE    19  2012
  8950760 12/31/12 20:10  STREET  FALSE   48  2012
  8951611 12/31/12 20:00  STREET  FALSE   40  2012
  8951802 12/31/12 19:00  STREET  TRUE    29  2012
  </code></pre>