Skip to content

Bounds error when indexing a matrix with NA_character_

1 message · Milan Bouchet-Valat

#
Hi!


I've just got a bounds error when trying to index a matrix with
NA_character_:
??????B
A???????a??b
? <NA> NA NA
? <NA> NA NA
?a?
?b?
NA NA?
Error in y[NA_character_, ] : index out of
bounds


Yet, I would have sworn it behaves like integer NA (which apparently
isn't true since it also occurs with R 3.0). Assuming this isn't simply
a bug, what's the rationale behind this, and is it documented anywhere?
For example, ?Extract says:
An indeed that's how it works for vectors:
<NA>?
? NA?

The inconsistency between NA classes, and between vectors and matrices
is surprising.


Thanks for your comments.