| 1494 | |
| 1495 | template <typename Rectangle> |
| 1496 | cpp11::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 |
no test coverage detected