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/
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) There is an
order
function here andorder(order(x))
isrank(x, ties = "first")
.2) A second way would be:
match(x, sort(x))
ADDED Second approach.