title: Conditional means across columns in R
body: <p>I have this dataframe: </p>
  
  <pre><code>year&lt;-1990:2000
  v1&lt;-1:11
  v2&lt;-20:30
  df1&lt;-data.frame(year,v1, v2)
  </code></pre>
  
  <p>I want to calculate the means across the <strong>all columns, but the first</strong> based on conditions (in my case, on conditions put on the first column)</p>
  
  <p>I want to do something like: </p>
  
  <p><code>colMeans(df1[,-1], condition is: year &gt; 1992 $ year&lt;1998)</code></p>
  
  <p>What is the most effective way in R to do this, if the number of columns are too large ? </p>