title: Multiple conditions while grouping data with NAs and empty cells
body: <p>I have a data frame as follows:</p>
  <pre><code>ID=c(1,1,2,3,3,1,2,4,2,1,2,1,4,3,1,2,3)
  text=c(&quot;a&quot;,&quot;&quot;,&quot;R&quot;,&quot;NA&quot;,&quot;&quot;,&quot;iy&quot;,&quot;&quot;,&quot;NA&quot;,&quot;ot&quot;,&quot;ir&quot;,&quot;&quot;,&quot;NA&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;&quot;,&quot;NA&quot;)
  
  df &lt;- data.frame(ID,text)
  </code></pre>
  <pre><code>df %&gt;% arrange(ID)
  
     ID text
  1   1    a
  2   1     
  3   1   iy
  4   1   ir
  5   1   NA
  6   1     
  7   2    R
  8   2     
  9   2   ot
  10  2     
  11  2     
  12  3   NA
  13  3     
  14  3     
  15  3   NA
  16  4   NA
  17  4     
  </code></pre>
  <p>For each <code>ID</code> I have a <code>character/ text</code> collected. I can have <code>NA</code> values and/or <code>empty</code> values corresponding to <code>IDs</code>.
  I would like to create a binary column to present if there is <code>text available</code> to any of the text rows collected for an <code>ID</code>. I am running this code:</p>
  <pre><code>df %&gt;% group_by(ID) %&gt;% 
      summarise(text_availabe=if(any(!is.na(text))) 1 else 0)
  
  </code></pre>
  <p>which populates the following where for <code>ID 3</code> and <code>ID 4</code>, it treats empty cells as they have text.</p>
  <pre><code>     ID text_availabe
    &lt;dbl&gt;         &lt;dbl&gt;
  1     1             1
  2     2             1
  3     3             1
  4     4             1
  </code></pre>
  <p>My idea output in this case should be like:</p>
  <pre><code>     ID text_availabe
    &lt;dbl&gt;         &lt;dbl&gt;
  1     1             1
  2     2             1
  3     3             0
  4     4             0
  
  </code></pre>
  <p>Thank you very much for your help in advance!</p>