/usr/lib/R/site-library/dplyr/include/dplyr/join_match.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 79 80 | #ifndef dplyr_join_match_H
#define dplyr_join_match_H
#include <dplyr/comparisons.h>
namespace dplyr {
// not defined on purpose
template <int LHS_RTYPE, int RHS_RTYPE, bool ACCEPT_NA_MATCH>
struct join_match;
// specialization when LHS_TYPE == RHS_TYPE
template <int RTYPE, bool ACCEPT_NA_MATCH>
struct join_match<RTYPE, RTYPE, ACCEPT_NA_MATCH> {
typedef comparisons<RTYPE> compare;
typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE;
static inline bool is_match(STORAGE lhs, STORAGE rhs) {
return compare::equal_or_both_na(lhs, rhs) && (ACCEPT_NA_MATCH || !compare::is_na(lhs));
}
};
// NaN also don't match for reals
template <bool ACCEPT_NA_MATCH>
struct join_match<REALSXP, REALSXP, ACCEPT_NA_MATCH> {
typedef comparisons<REALSXP> compare;
static inline bool is_match(double lhs, double rhs) {
if (ACCEPT_NA_MATCH)
return compare::equal_or_both_na(lhs, rhs);
else
return lhs == rhs && (ACCEPT_NA_MATCH || (!compare::is_na(lhs) && !compare::is_nan(lhs)));
}
};
// works for both LHS_RTYPE = INTSXP and LHS_RTYPE = LGLSXP
template <int LHS_RTYPE, bool ACCEPT_NA_MATCH>
struct join_match_int_double {
static inline bool is_match(int lhs, double rhs) {
LOG_VERBOSE << lhs << " " << rhs;
if (double(lhs) == rhs) {
return (lhs != NA_INTEGER);
}
else {
if (ACCEPT_NA_MATCH)
return (lhs == NA_INTEGER && ISNA(rhs));
else
return false;
}
}
};
template <bool ACCEPT_NA_MATCH>
struct join_match<INTSXP, REALSXP, ACCEPT_NA_MATCH> : join_match_int_double<INTSXP, ACCEPT_NA_MATCH> {};
template <bool ACCEPT_NA_MATCH>
struct join_match<LGLSXP, REALSXP, ACCEPT_NA_MATCH> : join_match_int_double<LGLSXP, ACCEPT_NA_MATCH> {};
template <int RHS_RTYPE, bool ACCEPT_NA_MATCH>
struct join_match_double_int {
static inline bool is_match(double lhs, int rhs) {
return join_match_int_double<RHS_RTYPE, ACCEPT_NA_MATCH>::is_match(rhs, lhs);
}
};
template <bool ACCEPT_NA_MATCH>
struct join_match<REALSXP, INTSXP, ACCEPT_NA_MATCH> : join_match_double_int<INTSXP, ACCEPT_NA_MATCH> {};
template <bool ACCEPT_NA_MATCH>
struct join_match<REALSXP, LGLSXP, ACCEPT_NA_MATCH> : join_match_double_int<LGLSXP, ACCEPT_NA_MATCH> {};
template <bool ACCEPT_NA_MATCH>
struct join_match<INTSXP, LGLSXP, ACCEPT_NA_MATCH> : join_match<INTSXP, INTSXP, ACCEPT_NA_MATCH> {};
template <bool ACCEPT_NA_MATCH>
struct join_match<LGLSXP, INTSXP, ACCEPT_NA_MATCH> : join_match<INTSXP, INTSXP, ACCEPT_NA_MATCH> {};
}
#endif // #ifndef dplyr_join_match_H
|