title: Creating multiple variables from single call to piping?
body: <p>I am new to tidyverse and want to use pipes to create two new variables, one representing the sum of the petal lengths by Species, and one representing the number of instances of each Species, and then to represent that in a new list alongside the Species names.</p>
  <p>The following code does the job, but</p>
  <pre><code>library(dplyr)
  
  petal_lengths &lt;- iris %&gt;% group_by(Species) %&gt;% summarise(total_petal_length = sum(Petal.Length))
  
  totals_per_species &lt;- iris %&gt;% count(Species, name=&quot;Total&quot;)
  
  combined_data &lt;- modifyList(petal_lengths,totals_per_species)
  </code></pre>
  <p>My questions are:</p>
  <ol>
  <li><p>Is it possible to do this without the creating those two intermediate variables petal_lengths and totals_per_species, i.e. through a single line of piping code rather than two.</p>
  </li>
  <li><p>If so, is doing this desirable, either abstractly or according to standard conceptions of good tidyverse coding style?</p>
  </li>
  </ol>
  <p>I read <a href="https://towardsdatascience.com/an-introduction-to-the-pipe-in-r-823090760d64" rel="nofollow noreferrer">here</a> that</p>
  <blockquote>
  <p>The pipe can only transport one object at a time, meaning it’s not so
  suited to functions that need multiple inputs or produce multiple
  outputs.</p>
  </blockquote>
  <p>which makes me think maybe the answer to my first question is &quot;No&quot;, but I'm not sure.</p>