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

Function vec_size

r/src/arrow_cpp11.h:382–395  ·  view source on GitHub ↗

A version of vctrs::vec_size() limited to the types that are supported at the C++ level. We currently handle record-style vectors (e.g., POSIXlt) at the R level such that by the time they get to C++ they are just a data.frame. This version also supports long vectors.

Source from the content-addressed store, hash-verified

380// they get to C++ they are just a data.frame. This version also
381// supports long vectors.
382static inline R_xlen_t vec_size(SEXP x) {
383 if (Rf_inherits(x, "data.frame")) {
384 if (Rf_length(x) > 0) {
385 return Rf_xlength(VECTOR_ELT(x, 0));
386 } else {
387 // This will expand the rownames if attr(x, "row.names") is ALTREP;
388 // however, this is probably not an important performance consideration
389 // since zero-column data.frames do not occur in many workflows.
390 return Rf_xlength(Rf_getAttrib(x, R_RowNamesSymbol));
391 }
392 } else {
393 return Rf_xlength(x);
394 }
395}
396
397} // namespace r
398} // namespace arrow

Callers 4

ExtendMethod · 0.85
ExtendSetupMethod · 0.85
Table__from_dotsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected