as_narrow_array.NULL: Convert R objects to Arrow vectors

View source: R/to-array.R

as_narrow_array.NULLR Documentation

Convert R objects to Arrow vectors

Description

These methods return an narrow_array() for R objects that don't involve copying or unnecessary allocating. Two excpetions are (1) ALTREP objects, which will be expanded, and (2) character vectors, which will be converted to UTF-8 and serialized as a single raw() vector.

Usage

## S3 method for class ''NULL''
as_narrow_array(x, ..., name = "")

## S3 method for class 'logical'
as_narrow_array(x, ..., name = "")

## S3 method for class 'integer'
as_narrow_array(x, ..., name = "")

## S3 method for class 'double'
as_narrow_array(x, ..., name = "")

## S3 method for class 'character'
as_narrow_array(x, ..., name = "")

## S3 method for class 'factor'
as_narrow_array(x, ..., name = "")

## S3 method for class 'raw'
as_narrow_array(x, ..., name = "")

## S3 method for class 'data.frame'
as_narrow_array(x, ..., name = "", nullable = FALSE)

Arguments

x

An object to convert to an narrow_array()

...

Passed to S3 methods

name

An optional name

nullable

TRUE if the type is semantically nullable

Value

An narrow_array()

Examples

as_narrow_array(NULL)
as_narrow_array(c(TRUE, FALSE, NA))
as_narrow_array(1:10)
as_narrow_array(c(1.1, 2.2))
as_narrow_array(as.raw(0x00))
as_narrow_array("fish")
as_narrow_array(data.frame(x = 1:10, y = as.raw(1:10)))


paleolimbot/arrowvctrs documentation built on Oct. 12, 2023, 7 a.m.