parse_npy_datatype: Parse a NumPy Array-protocol type string

View source: R/read_npy.R

parse_npy_datatypeR Documentation

Parse a NumPy Array-protocol type string

Description

Parse a NumPy Array-protocol type string

Usage

parse_npy_datatype(descr)

Arguments

descr

A NumPy dtype description string, or a list of such strings for structured dtypes

Details

If a list is passed to descr, each element can be of length 1, or of length 2 in which case the first element corresponds to the name of the field and the second to its dtype.

Value

A list containing the parsed data type information, including the base type, the number of bytes, and the endianness

Examples

parse_npy_datatype(">i8")
parse_npy_datatype("|b1")
# A structured datatype where each element has 3 components, all integers,
# named "r", "g" and "b".
parse_npy_datatype(list(c("r", "<i8"), c("g", "<i8"), c("b", "<i8")))


grumpy documentation built on Nov. 16, 2026, 5:07 p.m.