当 record_batch()
从一个或多个列构建 RecordBatch 时,as_record_batch()
将单个对象转换为 Arrow RecordBatch。
用法
as_record_batch(x, ..., schema = NULL)
# S3 method for class 'RecordBatch'
as_record_batch(x, ..., schema = NULL)
# S3 method for class 'Table'
as_record_batch(x, ..., schema = NULL)
# S3 method for class 'arrow_dplyr_query'
as_record_batch(x, ...)
# S3 method for class 'data.frame'
as_record_batch(x, ..., schema = NULL)
参数
- x
要转换为 Arrow RecordBatch 的对象
- ...
传递给 S3 方法
- schema
一个 Schema,或
NULL
(默认值)以从...
中的数据推断模式。当提供 Arrow IPC 缓冲区时,需要schema
。
值
一个 RecordBatch
示例
# use as_record_batch() for a single object
as_record_batch(data.frame(col1 = 1, col2 = "two"))
#> RecordBatch
#> 1 rows x 2 columns
#> $col1 <double>
#> $col2 <string>
#>
#> See $metadata for additional Schema metadata
# use record_batch() to create from columns
record_batch(col1 = 1, col2 = "two")
#> RecordBatch
#> 1 rows x 2 columns
#> $col1 <double>
#> $col2 <string>