/usr/lib/R/site-library/dplyr/include/dplyr/Result/In.h is in r-cran-dplyr 0.7.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #ifndef dplyr_Result_In_H
#define dplyr_Result_In_H
#include <tools/hash.h>
#include <dplyr/Result/Mutater.h>
namespace dplyr {
template <int RTYPE>
class In : public Mutater<LGLSXP, In<RTYPE> > {
public:
typedef typename Rcpp::Vector<RTYPE> Vec;
typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE;
In(Vec data_, const Vec& table_) :
data(data_),
set(table_.begin(), table_.end())
{}
void process_slice(LogicalVector& out, const SlicingIndex& index, const SlicingIndex& out_index) {
int n = index.size();
for (int i = 0; i < n; i++) {
STORAGE value = data[index[i]];
if (Vec::is_na(value)) {
out[ out_index[i] ] = false;
} else {
out[ out_index[i] ] = set.count(value);
}
}
}
private:
Vec data;
dplyr_hash_set<STORAGE> set;
};
}
#endif
|