Currently I have the following xts
table.
AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
2013-09-09 505.00 507.92 503.48 506.17 12116200 506.17
2013-09-10 506.20 507.45 489.50 494.64 26490200 494.64
2013-09-11 467.01 473.69 464.81 467.71 32031600 467.71
2013-09-12 468.50 475.40 466.01 472.69 14409400 472.69
2013-09-13 469.34 471.83 464.70 464.90 10649000 464.90
...
I can use the quantmod
package to calculate percent change Delt(AA[,"AAPL.Adjusted"],k=1)
however I'm new to R and wondering how to do this without the package and not using some sort of for loop. I guess it would be something like lag(k/k-1)-1
? Thank you.