I am trying to create a lag and lead variable in DataFrame, in R and Python this can be easily done with lag, lead, and shift function, but I still could not get it done in Julia.
My code is like this (does not work):
samplefine_call = @>begin samplefine_call @transform( price = blsprice.(:S, :K, :r, :T, :σ, :DIV) ) @transform(RND = lead(:price,1) - lag(:price, 1)) end
I can do it like this, but I need to merge it back to my original DataFrame, which is not efficient
RND = samplefine_call[3:end, :price] - samplefine_call[1:end-2, :price]