last
does not work on vectors of dates:
library(data.table)
f <- c("2014-11-10","2014-11-11")
last(f)
[1] "2014-11-11"
last(as.Date(f))
Error in last(as.Date(f)) :
data.table::last is trying to defer to xts::last because either x is not a vector, list, data.frame or data.table, or parameters such as 'n' or 'keep' have been provided as well. But xts hasn't been loaded.
the "helpful" message promised by ?last
says that the argument is not a vector (it is!) and requires a package xts
which I don't know about.
what is going on?