vctrs_extension_array | R Documentation |
Most common R vector types are converted automatically to a suitable
Arrow data type without the need for an extension type. For
vector types whose conversion is not suitably handled by default, you can
create a vctrs_extension_array()
, which passes vctrs::vec_data()
to
Array$create()
and calls vctrs::vec_restore()
when the Array is
converted back into an R vector.
vctrs_extension_array(x, ptype = vctrs::vec_ptype(x), storage_type = NULL)
vctrs_extension_type(x, storage_type = infer_type(vctrs::vec_data(x)))
x |
A vctr (i.e., |
ptype |
A |
storage_type |
The data type of the underlying storage array. |
vctrs_extension_array()
returns an ExtensionArray instance with a
vctrs_extension_type()
.
vctrs_extension_type()
returns an ExtensionType instance for the
extension name "arrow.r.vctrs".
(array <- vctrs_extension_array(as.POSIXlt("2022-01-02 03:45", tz = "UTC")))
array$type
as.vector(array)
temp_feather <- tempfile()
write_feather(arrow_table(col = array), temp_feather)
read_feather(temp_feather)
unlink(temp_feather)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.