I would like to index a column based off a different columns values. I have a table of 2 columns, one is years, from 1990 to 2020, and another column, called Column X which is a corresponding value. I would like some code which indexes Column X from 1990 to year X, whereby I can chose which year to call to based off a singular input(year = ...)
I tried the following code below but that didn't work:
transform(data$value, data$Year == 2014)