用于秩函数的 Rcpp 糖 [英] Rcpp sugar for rank function
本文介绍了用于秩函数的 Rcpp 糖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试使用 Rcpp 在 C++ 中获得向量的等级.我使用过其他的糖函数,比如
I have been trying to get the rank of a vector in c++ using Rcpp. I have used other sugar functions like
is_na();
C++ 中的 rank R 函数是否有类似的糖函数.在 Rcpp/
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) 有一个 order
函数 这里 和 order(order(x))
是 rank(x, ties = "first")
.
1) There is an order
function here and order(order(x))
is rank(x, ties = "first")
.
2) 第二种方式是:match(x, sort(x))
添加第二种方法.
这篇关于用于秩函数的 Rcpp 糖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文