Okay, #Rstats , this is the kind of thing that drives people _fucking crazy_ .
π
Okay, #Rstats , this is the kind of thing that drives people _fucking crazy_ .
π
@d2718 ah I see. I see all vectors as typed `character(0)`, `integer(0)`, `logical(0)`... These are zero length vectors of different types. When there is not enough info to infer the type, we have `NULL` as a fallback.
`c()` concatenates vectors.
If there is nothing to concatenate there is no type to infer so `NULL` is the outcome.
If we provide a type to the NULL vector (e.g. as.integer(NULL) we get the empty integer vector `integer(0)`.
That's how I make sense of it. I hope it helps.
Yeah, I think I had conflated this with the Lisp behavior wherein an empty list is nil, so I thought of `c()` (because it's `NULL`) as being an "empty list".
I understand what's going on; I gravitate toward static type systems and their comforting security, so R's extremely "informal" type system trips me up all the time, and this was one of those times!