na_vctrs: Vctrs extension type

View source: R/extension-vctrs.R

na_vctrsR 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)


nanoarrow documentation built on June 22, 2024, 9:37 a.m.