title: dplyr rowwise sum and other functions like max
body: <p>If I wanted to sum over some variables in a data-frame using <code>dplyr</code>, I could do:</p>
  
  <pre><code>&gt; head(iris)
    Sepal.Length Sepal.Width Petal.Length Petal.Width Species
  1          5.1         3.5          1.4         0.2  setosa
  2          4.9         3.0          1.4         0.2  setosa
  3          4.7         3.2          1.3         0.2  setosa
  4          4.6         3.1          1.5         0.2  setosa
  5          5.0         3.6          1.4         0.2  setosa
  6          5.4         3.9          1.7         0.4  setosa
  
  &gt; select(iris, starts_with('Petal')) %&gt;% rowSums()
    [1] 1.6 1.6 1.5 1.7 1.6 2.1 1.7 1.7 1.6 1.6 1.7 1.8 1.5 1.2 1.4 1.9 1.7 1.7 2.0 1.8 1.9 1.9 1.2 2.2 2.1 1.8 2.0 1.7 1.6 1.8 1.8 1.9 1.6 1.6 1.7 1.4
   [37] 1.5 1.5 1.5 1.7 1.6 1.6 1.5 2.2 2.3 1.7 1.8 1.6 1.7 1.6 6.1 6.0 6.4 5.3 6.1 5.8 6.3 4.3 5.9 5.3 4.5 5.7 5.0 6.1 4.9 5.8 6.0 5.1 6.0 5.0 6.6 5.3
   [73] 6.4 5.9 5.6 5.8 6.2 6.7 6.0 4.5 4.9 4.7 5.1 6.7 6.0 6.1 6.2 5.7 5.4 5.3 5.6 6.0 5.2 4.3 5.5 5.4 5.5 5.6 4.1 5.4 8.5 7.0 8.0 7.4 8.0 8.7 6.2 8.1
  [109] 7.6 8.6 7.1 7.2 7.6 7.0 7.5 7.6 7.3 8.9 9.2 6.5 8.0 6.9 8.7 6.7 7.8 7.8 6.6 6.7 7.7 7.4 8.0 8.4 7.8 6.6 7.0 8.4 8.0 7.3 6.6 7.5 8.0 7.4 7.0 8.2
  [145] 8.2 7.5 6.9 7.2 7.7 6.9
  </code></pre>
  
  <p>That's fine, but I would have thought <code>rowwise</code> accomplishes the same thing, but it doesn't, </p>
  
  <pre><code>&gt; select(iris, starts_with('Petal')) %&gt;% rowwise() %&gt;% sum()
  [1] 743.6
  </code></pre>
  
  <p>What I particularly want to do is select a set of columns, and create a new variable each value of which is the maximum value of each row of the selected columns. For example, if I selected the "Petal" columns, by maximum values would be 1.4, 1.4, 1.3 and so on. </p>
  
  <p>I could do it like this:</p>
  
  <pre><code>&gt; select(iris, starts_with('Petal')) %&gt;% apply(1, max)
  </code></pre>
  
  <p>and that's fine. But I'm just curious as to why the <code>rowwise</code> approach doesn't work. I realize I am using <code>rowwise</code> incorrectly, I'm just not sure why it is wrong. </p>