I have a dataframe called Deals
and one of the variables is $DealYear
. This contains 3 factors (2013, 2014, 2015). I have another column in Deals called $GDPDeflator
which is currently unpopulated. For example:
#Deals table
DealID DealAmt DealYear Name GDPDeflator Website
100101 200 2013 ABC 0 www.abc.com
120022 3000 2014 EFG 0 www.efg.com
300012 650 2013 HIJ 0 www.hij.com
I have a small second table called Deflator which contains the values I need for Deals$GDPDeflator
:
#Deflator table
Year Defl
2012 1.10
2013 1.08
2014 1.055
2015 1.046
2016 1.03
How can I look up the values for Deals$GDPDeflator
from Deflator$Defl
based on Deals$DealYear
and Deflator$Year
?