title: group by in dplyr and calculating percentages
body: <p>I have following dataframe in r</p>
  
  <pre><code>   Service      Container_Pick_Day
      ABC              0
      ABC              1
      ABC              1
      ABC              2
      ABC              NA
      ABC              0
      ABC              1
      DEF              NA
      DEF              0
      DEF              1
      DEF              1
      DEF              1
      DEF              2
      DEF              1
  </code></pre>
  
  <p>Column <code>Container_Pick_Day</code> is numeric and consist of <code>NA</code> values.
  What I want to do is calculate <code>Service</code> wise percentage of containers picked up on <code>0th day,after 1 day,2 day and so on</code> ignoring <code>NA</code> values</p>
  
  <p>Desired dataframe would be</p>
  
  <pre><code> Service      Container_Pick_Day      Percentage
      ABC              0                (2/6)*100 = 33.33 
      ABC              1                (3/6)*100 = 50  
      ABC              2                (1/6)*100 = 16.67
      DEF              0                (1/6)*100 = 16.67
      DEF              1                (3/6)*100 = 50
      DEF              2                (1/6)*100 = 16.67
  </code></pre>
  
  <p>I did following in R,but its generating NA values in output</p>
  
  <pre><code>  df%&gt;% 
       group_by(Service) %&gt;%
       summarise(pick_day_perc = n()/sum(Container_Pick_Day),na.rm=T) %&gt;% 
       as.data.frame()
  </code></pre>
  
  <p>Do I have to group by <code>Service and Container_Pick_Day</code> both ?</p>