Rcpp sugar for rank function

I am trying to get the rank of a vector in C ++ using Rcpp. I used other sugar functions like

is_na();

Is there a similar sugar function for a rank R function in C ++. There is also a list of available R-sugars at Rcpp /

+4
source share
1 answer

1) There is a orderfunction here and order(order(x))there rank(x, ties = "first").

2) . The second way:match(x, sort(x))

ADDED Second approach.

+8
source

Source: https://habr.com/ru/post/1540209/


All Articles