order( )函数--R语言

函数功能:
返回排序结果的值在原有向量中的位置

当前位置的值来源于原始向量中的哪个位置上的元素

函数语法:

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

  • 13
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值