Skip to content
Prev 38672 / 63424 Next

Surprising behavior of letters[c(NA, NA)]

Consider this:
[1] "b" "c"
[1] "b" NA
[1] NA  "c"
[1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[26] NA

The result is a 2-vector in each case until we get to c(NA, NA) and
then it unexpectedly changes from returning a 2-vector to returning a
26-vector.  I think most people would have expected that the answer
would be c(NA, NA).