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
How would I be able to do that?
I've started and made a vector:
vec 1 = c(trade_data$import, trade_data$export) diff(vec1)
however, that doesn't work at all. I have tried to search for similar questions, but I couldn't adapt to it. So I hope someone here can help me out
Thanks in advance!