| 210 | } |
| 211 | |
| 212 | Status 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 |
no test coverage detected