infer_nanoarrow_ptype: Infer an R vector prototype

View source: R/infer-ptype.R

infer_nanoarrow_ptypeR Documentation

Infer an R vector prototype

Description

Resolves the default to value to use in convert_array() and convert_array_stream(). The default conversions are:

Usage

infer_nanoarrow_ptype(x)

Arguments

x

A nanoarrow_schema, nanoarrow_array, or nanoarrow_array_stream.

Details

  • null to vctrs::unspecified()

  • boolean to logical()

  • int8, uint8, int16, uint16, and int13 to integer()

  • uint32, int64, uint64, float, and double to double()

  • string and large string to character()

  • struct to data.frame()

  • binary and large binary to blob::blob()

  • list, large_list, and fixed_size_list to vctrs::list_of()

  • time32 and time64 to hms::hms()

  • duration to difftime()

  • date32 to as.Date()

  • timestamp to as.POSIXct()

Additional conversions are possible by specifying an explicit value for to. For details of each conversion, see convert_array().

Value

An R vector of zero size describing the target into which the array should be materialized.

Examples

infer_nanoarrow_ptype(as_nanoarrow_array(1:10))


nanoarrow documentation built on Sept. 30, 2023, 1:06 a.m.