Learn R Programming

arrow (version 8.0.0)

to_arrow: Create an Arrow object from others

Description

This can be used in pipelines that pass data back and forth between Arrow and other processes (like DuckDB).

Usage

to_arrow(.data, as_arrow_query = TRUE)

Arguments

.data

the object to be converted

as_arrow_query

should the returned object be wrapped as an arrow_dplyr_query? (logical, default: TRUE)

Value

a RecordBatchReader object, wrapped as an arrow dplyr query which can be used in dplyr pipelines.

Examples

Run this code
# NOT RUN {
library(dplyr)

ds <- InMemoryDataset$create(mtcars)

ds %>%
  filter(mpg < 30) %>%
  to_duckdb() %>%
  group_by(cyl) %>%
  summarize(mean_mpg = mean(mpg, na.rm = TRUE)) %>%
  to_arrow() %>%
  collect()
# }

Run the code above in your browser using DataLab