| 1393 | |
| 1394 | template <typename Rectangle> |
| 1395 | cpp11::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 |
no test coverage detected