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

Function to_data_frame

r/src/array_to_vector.cpp:1373–1395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1371
1372template <typename Rectangle>
1373cpp11::writable::list to_data_frame(const std::shared_ptr<Rectangle>& data,
1374 bool use_threads) {
1375 int64_t nc = data->num_columns();
1376 int64_t nr = data->num_rows();
1377 cpp11::writable::strings names(nc);
1378
1379 arrow::r::RTasks tasks(use_threads);
1380
1381 cpp11::writable::list tbl(nc);
1382
1383 for (int i = 0; i < nc; i++) {
1384 names[i] = data->schema()->field(i)->name();
1385 tbl[i] = Converter::LazyConvert(to_chunks(data->column(i)), tasks);
1386 }
1387
1388 StopIfNotOk(tasks.Finish());
1389
1390 tbl.attr(R_NamesSymbol) = names;
1391 tbl.attr(R_ClassSymbol) = arrow::r::data::classes_tbl_df;
1392 tbl.attr(R_RowNamesSymbol) = arrow::r::short_row_names(static_cast<int>(nr));
1393
1394 return tbl;
1395}
1396
1397} // namespace r
1398} // namespace arrow

Callers 2

Table__to_dataframeFunction · 0.85

Calls 10

to_chunksFunction · 0.85
StopIfNotOkFunction · 0.85
short_row_namesFunction · 0.85
num_columnsMethod · 0.45
num_rowsMethod · 0.45
nameMethod · 0.45
fieldMethod · 0.45
schemaMethod · 0.45
columnMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected