title: Tidy way to summarize several columns of data in R?
body: <p>I have a large dataframe of transcript IDs and their associated gene names, as well as a column that indicates if a certain model reported that gene/transcript as significant. Every transcript will always be linked to a single gene, although each gene is associated with multiple transcripts. Here's a reproducible example:</p>
  <pre><code>transcript &lt;- c('t1', 't2', 't3', 't4', 't5', 't6', 't7','t8', 't9', 't10')
  gene &lt;- c('g1', 'g1', 'g1', 'g2', 'g2', 'g2', 'g3','g3', 'g3', 'g3')
  model1 &lt;- c('TRUE', 'TRUE', 'TRUE', 'FALSE', 'FALSE', 'FALSE', 'TRUE', 'TRUE', 'TRUE', 'TRUE')
  model2 &lt;-c('FALSE', 'FALSE', 'FALSE', 'TRUE', 'TRUE', 'TRUE', 'TRUE', 'TRUE', 'TRUE', 'TRUE')
  shared &lt;- data.frame(transcript, gene, model1, model2)
  shared
  
  transcript gene model1 model2
  &lt;chr&gt; &lt;chr&gt; &lt;chr&gt; &lt;chr&gt;
  t1  g1  TRUE    FALSE   
  t2  g1  TRUE    FALSE   
  t3  g1  TRUE    FALSE   
  t4  g2  FALSE   TRUE    
  t5  g2  FALSE   TRUE    
  t6  g2  FALSE   TRUE    
  t7  g3  TRUE    TRUE    
  t8  g3  TRUE    TRUE    
  t9  g3  TRUE    TRUE    
  t10 g3  TRUE    TRUE
  </code></pre>
  <p>I'd like to condense and summarize this df by the number and identity of TRUE values into something like this:</p>
  <pre><code>n_transcripts n_genes transcripts genes
  &lt;dbl&gt; &lt;dbl&gt; &lt;chr&gt; &lt;chr&gt;
  model1  7   2   t1;t2;t3;t7;t8;t9;t10   g1;g3
  model2  7   2   t4;t5;t6;t7;t8;t9;t10   g2;g3
  </code></pre>
  <p>I've tried creating a blank df and summarizing from the initial df, but keep getting held up when it comes to distinguishing between model1 and model2. In reality, I have dozens of models and would like to avoid going through each model manually. Does anyone have ideas about where to start with this?</p>