?"for"
says that seq
(the part after in
) is “[A]n expression evaluating to a vector (including a list and an expression) or to a pairlist or ‘NULL'”.
So your Date
vector is being coerced to numeric
because Date
objects aren’t strictly vectors:
is.vector(Sys.Date())
# [1] FALSE
is.vector(as.numeric(Sys.Date()))
# [1] TRUE
The same is true for POSIXct
vectors:
is.vector(Sys.time())
# [1] FALSE
is.vector(as.numeric(Sys.time()))
# [1] TRUE