I have a data frame containing panel data with patent and economic information for the years 2012-2020. The data variables are:
investment_year a time invariant variable, which is the year in which a certain company has received an initial investment;
patent_applications is the annual number of patents filed by a certain company. Company A, for example, filed five patents in 2018, two in 2019, and so on.
company_name investment_year year patent_applications A 2018 2020 7 A 2018 2019 2 A 2018 2018 5 . . . . . . . . . . . . A 2018 2012 4 B 2015 2020 10 B 2015 2019 3 B 2015 2018 7 . . . . . . . . . . . .
I would like to create a variable that contains the number of applications at t+2, where t is the investment year.
So, for example, for Company A the number of applications at t+2 (eg.patent_applications_t2) would be 7, as its investment year (2018) + 2 equals 2020.
I tried the line of code below, but it does not produce the correct result.
df$patent_applications_t2 <- df$patent_applications[df$Year == df$Investment_Year + 2]