title: Aggregating rmse and r2 in r
body: <p>Here is a sample data as 
  data2:</p>
  
  <p><code>lvl   x  y
    0 20.099 21.2
  100 21.133 21.4
  250 20.866 21.6
  500 22.679 21.8
  750 22.737 22.1
    0 30.396 32.0
  100 31.373 32.1
  250 31.303 32.2
  500 33.984 32.8
  750 44.563 38.0
    0 22.755 18.5
  100 23.194 18.8
  250 23.263 20.5
  500 23.061 27.9
  750 25.678 36.4</code> </p>
  
  <p>I tried to get the rmse  and r2 for each level (lvl) by the following lines of codes:
  <code>data2 %&gt;% group_by(lvl) %&gt;% summarise_each(funs(rmse(data2$x~data2$y)))</code> and <code>summary(lm(data2$x,data2$y))$r.squared</code> respectively, and I got the following error message when calculating rmse: </p>
  
  <blockquote>
    <p>Error: argument "obs" is missing, with no default</p>
  </blockquote>
  
  <p>and </p>
  
  <p><code># A tibble: 5 x 3
      lvl         x         y
    &lt;int&gt;     &lt;dbl&gt;     &lt;dbl&gt;
  1     0 0.6639888 0.6639888
  2   100 0.6639888 0.6639888
  3   250 0.6639888 0.6639888
  4   500 0.6639888 0.6639888
  5   750 0.6639888 0.6639888</code> </p>
  
  <p>when calculating r2. </p>
  
  <p>I wanted to aggregate the rmse and r2 for each level. In this case I have only 5 levels.So the answer will look like 5 rows X 3 columns with column names `"lvl","rmse","r2" Thank you in advance.</p>