/usr/lib/R/site-library/dplyr/include/dplyr/Result/CumMin.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 | #ifndef dplyr_Result_CumMin_H
#define dplyr_Result_CumMin_H
#include <dplyr/Result/Mutater.h>
namespace dplyr {
// version for REALSXP
template <int RTYPE>
class CumMin : public Mutater<RTYPE, CumMin<RTYPE> > {
public:
typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE;
CumMin(SEXP data_) : data(data_) {}
void process_slice(Vector<RTYPE>& out, const SlicingIndex& index, const SlicingIndex& out_index) {
int n = index.size();
STORAGE value = data[index[0]];
out[out_index[0]] = value;
if (NumericVector::is_na(value)) {
for (int i = 1; i < n; i++) {
out[out_index[i]] = value;
}
return;
}
for (int i = 1; i < n; i++) {
STORAGE current = data[index[i]];
if (Rcpp::traits::is_na<RTYPE>(current)) {
for (int j = i; j < n; j++) {
out[out_index[j]] = current;
}
return;
}
if (current < value) value = current;
out[out_index[i]] = value;
}
}
Vector<RTYPE> data;
};
}
#endif
|