请问r语言sort函数中index是什么意思?

r语言sort函数中index是什么意思


潇潇雨雨
浏览 1020回答 4
4回答

慕雪6442864

是一逻辑值,决定索引向量是否也要返回。注意只对某些情况有效。查到的参数说明如下:index.return logical indicating if the ordering index vector should be returned as well; this is only available for a few cases, the default na.last = NA and full sorting of non-factors.

沧海一幻觉

1、sort()函数描述:对给定区间所有元素进行排序。sort()函数语法:sort(begin,end),表示一个范围。2、sort()函数举例:123456789#include&nbsp;<algorithm>#include&nbsp;<iostream>using&nbsp;namespace&nbsp;std;main(){int&nbsp;a[11]={2,4,8,5,7,1,10,6,9,3};//a的长度=待排数据个数+1sort(a,a+10);//对[a,a+10)排序for(int&nbsp;i=0;i<10;++i)&nbsp;cout<<a[i]<<endl;}&nbsp;

偶然的你

排序(sort)语法:void sort();void sort( Comp compfunction );sort()函数为链表排序,默认是升序。如果指定compfunction的话,就采用指定函数来判定两个元素的大小

海绵宝宝撒

例如:有个 int a[1000] 的数组要排序。而比较函数你已经写好了名字是 comp,则这样写:1qsort(a,1000,sizeof(int),comp);&nbsp; 比较函数 comp 如下:1234int&nbsp;comp&nbsp;(&nbsp;const&nbsp;void&nbsp;*a,&nbsp;const&nbsp;void&nbsp;*b&nbsp;){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;*&nbsp;(&nbsp;int&nbsp;*&nbsp;)&nbsp;a&nbsp;-&nbsp;*&nbsp;(&nbsp;int&nbsp;*&nbsp;)&nbsp;b;}&nbsp;详细的可以查一下关于 qsort 的说明。
打开App,查看更多内容
随时随地看视频慕课网APP