title: R How to Get the Average of One Variable based on Ranges of Another Variable?
body: <p>If I have a series of observations with two variables X and Y, how can I get the average value of Y based on ranges of variable X?</p>
  
  <p>So for example, with some data like:</p>
  
  <p><code>df = data.frame(x=runif(50,1,100),y=runif(50,300,700))</code> </p>
  
  <p>How could I get the answer to "When X is 1-10 the average of y 332.4, when X is 11-20 the average of y is 632.3, etc...."</p>