0

I cannot understand this:

f <- c("2014-11-10","2014-11-11")
is.vector(f)
[1] TRUE
is.vector(as.Date(f))
[1] FALSE     <------------- WTF?!!!
str(as.Date(f))
 Date[1:2], format: "2014-11-10" "2014-11-11"
str(f)
 chr [1:2] "2014-11-10" "2014-11-11"

why isn't as.Date(f) a vector?!

sds
  • 58,617
  • 29
  • 161
  • 278
  • 3
    In the description of `?is.vector`: "`is.vector` returns `TRUE` if `x` is a vector of the specified mode having no attributes _other than names_. It returns `FALSE` otherwise." `attributes(as.Date(f))` contains something other than "names". – Joshua Ulrich Nov 10 '14 at 15:33
  • See also the `is.object` function. In a sense, every object in R is an object, but only some objects are objects. – nicola Nov 10 '14 at 15:38
  • @nicola that sounds like a `fortunes::fortune` – rawr Nov 10 '14 at 17:40

0 Answers0