/usr/lib/R/site-library/dplyr/include/tools/collapse.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 | #ifndef dplyr_collapse_H
#define dplyr_collapse_H
namespace dplyr {
template <int RTYPE>
const char* to_string_utf8(typename Rcpp::traits::storage_type<RTYPE>::type from) {
SEXP s = Rcpp::internal::r_coerce<RTYPE, STRSXP>(from);
return Rf_translateCharUTF8(s);
}
template <int RTYPE>
std::string collapse_utf8(const Vector<RTYPE>& x, const char* sep = ", ", const char* quote = "") {
std::stringstream ss;
int n = x.size();
if (n > 0) {
ss << quote << to_string_utf8<RTYPE>(x[0]) << quote;
for (int i = 1; i < n; i++) {
const char* st = to_string_utf8<RTYPE>(x[i]);
ss << sep << quote << st << quote;
}
}
return ss.str();
}
}
#endif
|