In short: Is there an rcpp or rcpparmadillo function that calculates rank with ties = "random"?
Long Summary: I am trying to convert a program written in R to a combination of C++, Rcpp and Rcpp Armadillo. The R program makes use of the R function Rank on a numeric vector called "fitness.old". Some example calls are the following:
sort(pop[rank(fitness.old,ties.method="random")==1,])
sample(v,1,prob=rank(-fitness.old[v])
I have spent lots of time trying to find equivalent functions or code for Rank in Rcpp Armadillo or Rcpp but have had no luck. This post
was the closest I could find to a possible solution. However, I want rank(x, ties = "random") NOT rank(x, ties = "first"). Does anyone know how I can accomplish this?