/usr/lib/R/site-library/dplyr/include/tools/SymbolVector.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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | #ifndef dplyr_tools_SymbolVector_h
#define dplyr_tools_SymbolVector_h
#include <tools/SymbolString.h>
#include <tools/match.h>
namespace dplyr {
class SymbolVector {
public:
SymbolVector() {}
template <class T>
explicit SymbolVector(T v_) : v(v_) {}
explicit SymbolVector(SEXP x) : v(init(x)) {}
explicit SymbolVector(RObject x) : v(init(x)) {}
public:
void push_back(const SymbolString& s) {
v.push_back(s.get_string());
}
void remove(const R_xlen_t idx) {
v.erase(v.begin() + idx);
}
const SymbolString operator[](const R_xlen_t i) const {
return SymbolString(v[i]);
}
void set(int i, const SymbolString& x) {
v[i] = x.get_string();
}
R_xlen_t size() const {
return v.size();
}
int match(const SymbolString& s) const {
CharacterVector vs = CharacterVector::create(s.get_string());
return as<int>(match(vs));
}
const IntegerVector match(const CharacterVector& m) const {
return r_match(m, v);
}
const IntegerVector match_in_table(const CharacterVector& t) const {
return r_match(v, t);
}
const CharacterVector get_vector() const {
return v;
}
private:
CharacterVector v;
SEXP init(SEXP x) {
if (Rf_isNull(x))
return CharacterVector();
else
return x;
}
};
}
namespace Rcpp {
using namespace dplyr;
template <> inline SEXP wrap(const SymbolVector& x) {
return x.get_vector();
}
}
#endif
|