I am a total newbie in R and I am currently trying to figure out how to calculate the yearly differences between two columns.
I have a dataset (?) containing the years from 2010-2016 with the yearly export / import. I am supposed to create a new variable or vector for the yearly differences in imports and
exports.
I also have a table with the columns: 1) year 2) import 3) export
I am supposed to use indexing to find the value of imports in 2010 and 2014. I am then supposed to assign these values to a new object using the concatenate function. How would I do this?
I've started with the following:
trade_data$import[2010]
However, this doesn't work. But if I for example us 1 instead, it will take the first year in the column.
Is it possible to do so, that I can just write in the year I want to index?