There are a variety of ways of indexing things in R. Most of them make sense in context.
在r中有很多索引的方法,大多数都是有意义的。
However, I cannot figure out what the rationale behind
然而,我不知道背后的理由是什么
> c(1:10)[NA]
[1] NA NA NA NA NA NA NA NA NA NA
What is going on here?
这是怎么回事?
1 个解决方案
#1
4
This form of indexing is specifically mentioned in the docs (see ?"["
):
这种索引形式在文档中特别提到(见“?”):
NAs in indexing
When extracting, a numerical, logical or character NA index picks an unknown element and so returns NA in the corresponding element of a logical, integer, numeric, complex or character result, and NULL for a list. (It returns 00 for a raw result.)
当提取时,数字、逻辑或字符NA索引选择一个未知元素,因此返回逻辑、整数、数字、复杂或字符结果的对应元素中的NA,并返回列表的NULL。(原始结果返回00)
#1
4
This form of indexing is specifically mentioned in the docs (see ?"["
):
这种索引形式在文档中特别提到(见“?”):
NAs in indexing
When extracting, a numerical, logical or character NA index picks an unknown element and so returns NA in the corresponding element of a logical, integer, numeric, complex or character result, and NULL for a list. (It returns 00 for a raw result.)
当提取时,数字、逻辑或字符NA索引选择一个未知元素,因此返回逻辑、整数、数字、复杂或字符结果的对应元素中的NA,并返回列表的NULL。(原始结果返回00)