library(AMIM)
library(data.table)
data <- AMIM::exampledata # load the example data
AMIM <- AMIM.roll(
data.table = data, identity.col = "ticker", rollWindow = 60,
Date.col = "Date", return.col = "RET", min.obs = 30, max.lag = 10
)
AMIM[, .SD[(.N - 5):(.N), ], by = ticker] # Last 5 rows of each instrument
Run the code above in your browser using DataLab