Why is c (1:10) [NA] the same as rep (10, NA)?
1 answer
This form of indexing is specifically mentioned in the documents (see ?"["
):
NAs when indexing
When retrieving a numeric, boolean, or character index, NA selects an unknown element and therefore returns NA to the corresponding Boolean, integer, numeric, complex, or character result, and NULL for a list. (It returns 00 for the original result.)
+4
source to share