0

I have a standard XTS stock price object. I would like to add a column that consists of the forward one year return. So, if the row I’m evaluating is 2019-03-01, I would like the return of 2019-03-01 to 2020-03-01 to be added. I have experimented with some ugly for loops, but I figure there has to be an elegant solution to this problem. Thanks!

I created a subset using stockxts[ā€œ2019-03-01/2020-03-01ā€] and then used first and last.

zephryl
  • 14,633
  • 3
  • 11
  • 30
Kevin Muir
  • 21
  • 3

0 Answers0