跳到内容

as_arrow_array() 函数与 Array$create() 完全相同,不同之处在于它是一个 S3 泛型,允许在其他包中定义方法以将对象转换为 ArrayArray$create() 速度稍快,因为它会尝试在 C++ 中进行转换,然后再回退到 as_arrow_array()

用法

as_arrow_array(x, ..., type = NULL)

# S3 method for class 'Array'
as_arrow_array(x, ..., type = NULL)

# S3 method for class 'Scalar'
as_arrow_array(x, ..., type = NULL)

# S3 method for class 'ChunkedArray'
as_arrow_array(x, ..., type = NULL)

参数

x

要转换为 Arrow 数组的对象

...

传递给 S3 方法

type

最终数组的 类型NULL 值将默认为 infer_type() 猜测的类型。

类型为 typeArray

示例

as_arrow_array(1:5)
#> Array
#> <int32>
#> [
#>   1,
#>   2,
#>   3,
#>   4,
#>   5
#> ]