This file is indexed.

/usr/lib/R/site-library/dplyr/include/dplyr/Result/GroupedSubset.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
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef dplyr_GroupedSubset_H
#define dplyr_GroupedSubset_H

#include <tools/ShrinkableVector.h>

#include <dplyr/DataFrameSubsetVisitors.h>
#include <dplyr/SummarisedVariable.h>
#include <dplyr/Result/GroupedSubsetBase.h>

namespace dplyr {

template <int RTYPE>
class GroupedSubsetTemplate : public GroupedSubset {
public:
  typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE;
  GroupedSubsetTemplate(SEXP x, int max_size) :
    object(x), output(max_size, object), start(Rcpp::internal::r_vector_start<RTYPE>(object)) {}

  virtual SEXP get(const SlicingIndex& indices) {
    output.borrow(indices, start);
    return output;
  }
  virtual SEXP get_variable() const {
    return object;
  }
  virtual bool is_summary() const {
    return false;
  }

private:
  SEXP object;
  ShrinkableVector<RTYPE> output;
  STORAGE* start;
};

class DataFrameGroupedSubset : public GroupedSubset {
public:
  DataFrameGroupedSubset(SEXP x) : data(x), visitors(data) {}

  virtual SEXP get(const SlicingIndex& indices) {
    return visitors.subset(indices, get_class(data));
  }

  virtual SEXP get_variable() const {
    return data;
  }

  virtual bool is_summary() const {
    return false;
  }

private:
  DataFrame data;
  DataFrameSubsetVisitors visitors;
};

inline GroupedSubset* grouped_subset(SEXP x, int max_size) {
  switch (TYPEOF(x)) {
  case INTSXP:
    return new GroupedSubsetTemplate<INTSXP>(x, max_size);
  case REALSXP:
    return new GroupedSubsetTemplate<REALSXP>(x, max_size);
  case LGLSXP:
    return new GroupedSubsetTemplate<LGLSXP>(x, max_size);
  case STRSXP:
    return new GroupedSubsetTemplate<STRSXP>(x, max_size);
  case VECSXP:
    if (Rf_inherits(x, "data.frame"))
      return new DataFrameGroupedSubset(x);
    if (Rf_inherits(x, "POSIXlt")) {
      stop("POSIXlt not supported");
    }
    return new GroupedSubsetTemplate<VECSXP>(x, max_size);
  case CPLXSXP:
    return new GroupedSubsetTemplate<CPLXSXP>(x, max_size);
  default:
    break;
  }
  stop("is of unsupported type %s", Rf_type2char(TYPEOF(x)));
}


template <int RTYPE>
class SummarisedSubsetTemplate : public GroupedSubset {
public:
  typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE;

  SummarisedSubsetTemplate(SummarisedVariable x) :
    object(x), output(1)
  {
    copy_most_attributes(output, object);
  }

  virtual SEXP get(const SlicingIndex& indices) {
    output[0] = object[indices.group()];
    return output;
  }
  virtual SEXP get_variable() const {
    return object;
  }
  virtual bool is_summary() const {
    return true;
  }

private:
  Rcpp::Vector<RTYPE> object;
  Rcpp::Vector<RTYPE> output;
};

template <>
inline SEXP SummarisedSubsetTemplate<VECSXP>::get(const SlicingIndex& indices) {
  return List::create(object[indices.group()]);
}

inline GroupedSubset* summarised_subset(SummarisedVariable x) {
  switch (TYPEOF(x)) {
  case LGLSXP:
    return new SummarisedSubsetTemplate<LGLSXP>(x);
  case INTSXP:
    return new SummarisedSubsetTemplate<INTSXP>(x);
  case REALSXP:
    return new SummarisedSubsetTemplate<REALSXP>(x);
  case STRSXP:
    return new SummarisedSubsetTemplate<STRSXP>(x);
  case VECSXP:
    return new SummarisedSubsetTemplate<VECSXP>(x);
  case CPLXSXP:
    return new SummarisedSubsetTemplate<CPLXSXP>(x);
  default:
    break;
  }
  stop("is of unsupported type %s", Rf_type2char(TYPEOF(x)));
}
}

#endif