I am running forecasts on data.tables that sometimes have NA values in the tail. These values are not yet available and can be removed. How do I remove NA values at the end of a series?
library(data.table)
DT = data.table(x=rep(c("a","b","c"),each=3), y=c(1,3,6), v=1:9)
DT[c(4, 8:9), v := NA]
# required output:
DT[, head(.SD, 7 )]