MCPcopy Create free account
hub / github.com/apache/arrow / count_fields

Function count_fields

r/src/recordbatch.cpp:212–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212Status count_fields(SEXP lst, int* out) {
213 int res = 0;
214 R_xlen_t n = XLENGTH(lst);
215 SEXP names = Rf_getAttrib(lst, R_NamesSymbol);
216 for (R_xlen_t i = 0; i < n; i++) {
217 if (LENGTH(STRING_ELT(names, i)) > 0) {
218 ++res;
219 } else {
220 SEXP x = VECTOR_ELT(lst, i);
221 if (Rf_inherits(x, "data.frame")) {
222 res += XLENGTH(x);
223 } else {
224 return Status::RError(
225 "only data frames are allowed as unnamed arguments to be auto spliced");
226 }
227 }
228 }
229 *out = res;
230 return Status::OK();
231}
232
233} // namespace r
234} // namespace arrow

Callers 3

RecordBatch__from_arraysFunction · 0.85
Table__from_dotsFunction · 0.85

Calls 2

RErrorFunction · 0.85
OKFunction · 0.50

Tested by

no test coverage detected