Revision 2a9508b29dfa63182cfa56e60908d36e099266fd authored by Christian Thiele on 29 June 2021, 05:30:02 UTC, committed by cran-robot on 29 June 2021, 05:30:02 UTC
1 parent 2900dc2
one_unique.cpp
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
LogicalVector one_unique_num(NumericVector x) {
int n = x.size();
double first_val = x[0];
for(int i = 1; i < n; ++i) {
if (x[i] != first_val) return false;
}
return true;
}
// [[Rcpp::export]]
LogicalVector one_unique_char(CharacterVector x) {
int n = x.size();
String first_val = x[0];
for(int i = 1; i < n; ++i) {
if (x[i] != first_val) return false;
}
return true;
}

Computing file changes ...