In the process of (mostly) answering this question, I stumbled across something that I feel like I really should already have seen before. Let\'s say you\'ve got a list:
For non-trivial lists, as.character uses deparse to generate the strings.
Only if the vector is integer and 1,2,3,...,n - then it deparses as 1:n.
c(1,2,3) is double whereas 1:3 is integer...
No idea :-)
...but look at deparse if you want to understand as.character here:
deparse(c(1L, 2L, 3L)) # 1:3
deparse(c(3L, 2L, 1L)) # c(3L, 2L, 1L)
deparse(c(1, 2, 3)) # c(1, 2, 3)