title: grab some columns and calculate the proportion inr
body: <pre><code>id=1:5
  age1=c(67,39,97,55,37)
  age2=c(300,122,333,70,333)
  age3=c(1,3,6,1,3)
  age4=c(56,33,34,77,99)
  gender=c(&quot;f&quot;,&quot;m&quot;,&quot;f&quot;,&quot;f&quot;,&quot;m&quot;)
  data=data.frame(id, age1, age2, age3, age4, gender)
  
  length(data$age1[data$age1 &gt; 50])/length(data$age1)
  length(data$age2[data$age2 &gt; 50])/length(data$age2)
  length(data$age3[data$age3 &gt; 50])/length(data$age3)
  length(data$age4[data$age4 &gt; 50])/length(data$age4)
  </code></pre>
  <p>First, I want to grab the age columns (age1, age2, age3, age4) using <code>%in%</code> operator (grab the columns whose name has age in it)</p>
  <p>and then, I want to calculate the proportion-
  but my code seems to be inefficient.
  This is a reproducible example, and in my data, I have different 30 ages...</p>