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

Function to_data_frame

r/src/array_to_vector.cpp:1496–1518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494
1495template <typename Rectangle>
1496cpp11::writable::list to_data_frame(const std::shared_ptr<Rectangle>& data,
1497 bool use_threads) {
1498 int64_t nc = data->num_columns();
1499 int64_t nr = data->num_rows();
1500 cpp11::writable::strings names(nc);
1501
1502 arrow::r::RTasks tasks(use_threads);
1503
1504 cpp11::writable::list tbl(nc);
1505
1506 for (int i = 0; i < nc; i++) {
1507 names[i] = data->schema()->field(i)->name();
1508 tbl[i] = Converter::LazyConvert(to_chunks(data->column(i)), tasks);
1509 }
1510
1511 StopIfNotOk(tasks.Finish());
1512
1513 tbl.attr(R_NamesSymbol) = names;
1514 tbl.attr(R_ClassSymbol) = arrow::r::data::classes_tbl_df;
1515 tbl.attr(R_RowNamesSymbol) = arrow::r::short_row_names(static_cast<int>(nr));
1516
1517 return tbl;
1518}
1519
1520} // namespace r
1521} // 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