Learn R Programming

nanoarrow (version 0.7.0-3)

as_nanoarrow_array: 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)

Value

An object of class 'nanoarrow_array'

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().

Examples

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

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

Run the code above in your browser using DataLab