title: How to generate summary statistics if indicator variable is equal to 1?
body: <p>I am working with the following data frame:</p>
  <pre><code>Layer       Grade              Players            NYAL 27
  Top           A         NY 08; NY 27; NY 80          1
  Bottom        D         MA 27; MA 45; MA 65          0
  Middle        B         NY 09; MA 48; NY 66          0
  Bottom        C         NY 06; NY 27; NY 80          1
  ...
  </code></pre>
  <p>I've been using the following code to generate summary statistics (count, %) for two separate categories.</p>
  <pre><code>df %&gt;% 
  count('NYAL 27',Grade, name = 'Count') %&gt;% 
  group_by('NYAL 27') %&gt;% 
  mutate(Perc = prop.table(Count) * 100)
  </code></pre>
  <p>'NYAL 27' is the name of a binary variable that indicates if that player is present in a given observation. The code is working right now, but it includes observations in the summary statistics where the indicator variable is equal to 0. I want to generate the same summary statistics but only if 'NYAL 27' is equal to 1.  How can I get it so it will only report summary stats if the indicator is equal to 1?</p>
  <p>Desired output would look something like this, again, only if the indicator variable equals 1.</p>
  <pre><code>                    COUNT  PERC
   NYAL 27     A       1      50  
   NYAL 27     B       0       0  
   NYAL 27     C       1      50 
   NYAL 27     D       0      0  
  </code></pre>