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

Function to_data_frame

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

Source from the content-addressed store, hash-verified

1393
1394template <typename Rectangle>
1395cpp11::writable::list to_data_frame(const std::shared_ptr<Rectangle>& data,
1396 bool use_threads) {
1397 int64_t nc = data->num_columns();
1398 int64_t nr = data->num_rows();
1399 cpp11::writable::strings names(nc);
1400
1401 arrow::r::RTasks tasks(use_threads);
1402
1403 cpp11::writable::list tbl(nc);
1404
1405 for (int i = 0; i < nc; i++) {
1406 names[i] = data->schema()->field(i)->name();
1407 tbl[i] = Converter::LazyConvert(to_chunks(data->column(i)), tasks);
1408 }
1409
1410 StopIfNotOk(tasks.Finish());
1411
1412 tbl.attr(R_NamesSymbol) = names;
1413 tbl.attr(R_ClassSymbol) = arrow::r::data::classes_tbl_df;
1414 tbl.attr(R_RowNamesSymbol) = arrow::r::short_row_names(static_cast<int>(nr));
1415
1416 return tbl;
1417}
1418
1419} // namespace r
1420} // 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