as_nanoarrow_array: Convert an object to a nanoarrow array

View source: R/array.R

as_nanoarrow_arrayR Documentation

Convert an object to a nanoarrow array

Description

In nanoarrow an 'array' refers to the ⁠struct ArrowArray⁠ definition in the Arrow C data interface. At the R level, we attach a schema such that functionally the nanoarrow_array class can be used in a similar way as an arrow::Array. Note that in nanoarrow an arrow::RecordBatch and a non-nullable arrow::StructArray are represented identically.

Usage

as_nanoarrow_array(x, ..., schema = NULL)

Arguments

x

An object to convert to a array

...

Passed to S3 methods

schema

An optional schema used to enforce conversion to a particular type. Defaults to infer_nanoarrow_schema().

Value

An object of class 'nanoarrow_array'

Examples

(array <- as_nanoarrow_array(1:5))
as.vector(array)

(array <- as_nanoarrow_array(data.frame(x = 1:5)))
as.data.frame(array)


nanoarrow documentation built on Sept. 30, 2023, 1:06 a.m.