It's probably gonna be a stupid question, but I can't find the answer quickly and I'm too curious to give up even if late.
In essence, why 1L:3L
and letters
are both vectors
> is.vector(1:3)
[1] TRUE
> is.vector(letters)
[1] TRUE
and a sequence of dates is not?
x <- structure(1:3, class = "Date")
> is.vector(x)
[1] FALSE
From ?vector
The atomic modes are "logical", "integer", "numeric" (synonym "double"),
"complex", "character" and "raw".
Fine, clear, even though x
is atomic...
> is.atomic(x)
[1] TRUE
So, what makes a dates vector not to be read as vector? (in means of as.vector()
) and what is there behind this difference?
This question comes from a try to use embed
with dates which fails cause it wants vector or array. But from a structural point of view I can't see the difference between 1L:10L
and structure(1L:10L, class="Date")