Rcpp sugar for rank function

本小妞迷上赌 提交于 2020-01-01 12:23:52

问题


I have been trying to get the rank of a vector in c++ using Rcpp. I have used other sugar functions like

is_na();

Is there a similar sugar function for rank R function in c++. Also is there any list of available R sugar functions in Rcpp/


回答1:


1) There is an order function here and order(order(x)) is rank(x, ties = "first").

2) A second way would be: match(x, sort(x))

ADDED Second approach.



来源:https://stackoverflow.com/questions/23606266/rcpp-sugar-for-rank-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!