函数功能:
返回排序结果的值在原有向量中的位置
或
当前位置的值来源于原始向量中的哪个位置上的元素
函数语法:
order(..., na.last = TRUE, decreasing = FALSE,
method = c("auto", "shell", "radix"))
函数参数:
...
a sequence of numeric, complex, character or logical vectors,
all of the same length, or a class R object.
排序的R对象
na.last
for controlling the treatment of NAs.
If TRUE, missing values in the data are put last;
if FALSE, they are put first;
if NA, they are removed
缺失值处理:若取值为TRUE,缺失值被放在最后面;若取值为FALSE,缺失值被放在最前面;若取值为NA,缺失值被移除。
decreasing
logical. Should the sort order be increasing or decreasing? For the "radix" method, this can be a vector of length equal to the number of arguments in .... For the other methods, it must be length one.
降序排序:逻辑值,升序还是降序。
默认升序,返回的为排序结果的值在原有向量中的位置
当向量包含NA值。
官方文档 order