Sorry, if this is a duplicate. I could not find an answer.
I have a named vector (logical in this case):
a <- c("a" = TRUE, "b" = TRUE, "c" = FALSE, "e" = FALSE)
a
a b c e
TRUE TRUE FALSE FALSE
If I turn it into an integer, the names are gone.
> as.integer(a)
[1] 1 1 0 0
How can I prevent this?