#include #include // for std::vector #include // for std::less, etc #include // for count_if using namespace Rcpp ; // [[Rcpp::export]] int rsi_calc_S(std::vector x, bool include_I) { if (include_I == TRUE) { return count_if(x.begin(), x.end(), bind2nd(std::less_equal(), 2)); } else { return count_if(x.begin(), x.end(), bind2nd(std::less(), 2)); } } // [[Rcpp::export]] int rsi_calc_R(std::vector x, bool include_I) { if (include_I == TRUE) { return count_if(x.begin(), x.end(), bind2nd(std::greater_equal(), 2)); } else { return count_if(x.begin(), x.end(), bind2nd(std::greater(), 2)); } } // [[Rcpp::export]] int rsi_calc_total(std::vector x) { return count_if(x.begin(), x.end(), bind2nd(std::less_equal(), 3)); }