I've data on several macroeconomic variables for 14 Indian states pertaning to the years 1999-2020. I want to multiply each of these variables by a column of GDP deflator, i.e for each of the 21 observations for a state I want to multiply these to the GDP deflator to their corresponding year and do the same exercise for each state. How should I do this in R?
Edit1: My data is in long format.
Year State Var1
1999 Andhra Pradesh x
2000 Andhra Pradesh y
. . .
. . .
. . .
2020 Andhra Pradesh z
1999 Bihar u
2000 Bihar v
. . .
. . .
. . .
2020 Bihar w
A different data frame of GDP deflator common for all states
Year GDP_defaltor
1999 80
2000 100
. .
. .
. .
2020 150
Hope it helps.