na_vctrs {nanoarrow}R Documentation

Vctrs extension type

Description

The Arrow format provides a rich type system that can handle most R vector types; however, many R vector types do not roundtrip perfectly through Arrow memory. The vctrs extension type uses vctrs::vec_data(), vctrs::vec_restore(), and vctrs::vec_ptype() in calls to as_nanoarrow_array() and convert_array() to ensure roundtrip fidelity.

Usage

na_vctrs(ptype, storage_type = NULL)

Arguments

ptype

A vctrs prototype as returned by vctrs::vec_ptype(). The prototype can be of arbitrary size, but a zero-size vector is sufficient here.

storage_type

For na_extension(), the underlying value type.

Value

A nanoarrow_schema.

Examples


vctr <- as.POSIXlt("2000-01-02 03:45", tz = "UTC")
array <- as_nanoarrow_array(vctr, schema = na_vctrs(vctr))
infer_nanoarrow_ptype(array)
convert_array(array)


[Package nanoarrow version 0.5.0.1 Index]