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.
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?
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
Aucun commentaire:
Enregistrer un commentaire