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.
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.
Examples
vctr <- as.POSIXlt("2000-01-02 03:45", tz = "UTC")
array <- as_nanoarrow_array(vctr, schema = na_vctrs(vctr))
infer_nanoarrow_ptype(array)
#> POSIXlt of length 0
convert_array(array)
#> [1] "2000-01-02 03:45:00 UTC"