title: conditional extraction of data from dataframe in R
body: <p>I have a data frame as shown below. What I want to do is, for example, the Aston Martin car is 4 years old, so I have to pull the relevant data from the year4_6 column. Or the Honda car is 7 years old, so I should use the year7_11 data.</p>
  <p>I tried to write an if-else statement but I couldn't. I wonder what kind of code can I write for this, should I use a package?</p>
  <pre><code>hub.cc     hub.make hub.age hub.year1_3 hub.year4_6 hub.year7_11
  1300 Aston Martin       4         480         335          189
  1800       Toyota       1        1352        1059          624
  2000        Honda       7        2129        1642          965
  1600        Honda       9         768         576          335
  </code></pre>