Skip to contents

Represents a multi-dimensional array that can be accessed and subsetted via list of Slice instances.

Value

The data as a flat vector. The data as a flat raw vector. Convert NestArray object to R array (for S3 method)

Details

The Zarr NestedArray class.

Public fields

shape

The shape of the array.

dtype

The Zarr dtype of the array, as a string like ">f8".

dtype_obj

The Zarr dtype of the array, as a Dtype instance.

data

The array contents as a base R array.

Methods


Method new()

Create a new NestedArray instance.

Usage

NestedArray$new(data, shape = NA, dtype = NA, order = NA)

Arguments

data

The data to initialize the array with. Either NULL, base R array, base R vector (numeric/logical), scalar, or raw vector.

shape

The shape of the array.

dtype

The Zarr dtype of the array, as a string like ">f8".

order

The order of the array, either "C" or "F". Only used when data is a raw vector. Optional.

Returns

A NestedArray instance.


Method get()

Subset the array.

Usage

NestedArray$get(selection)

Arguments

selection

A list of slices.

Returns

A new NestedArray (potentially a subset) representing the selection.


Method set()

Set a subset of the array.

Usage

NestedArray$set(selection, value)

Arguments

selection

A list of slices.

value

A NestedArray or a base R array.


Method flatten()

Flatten the array contents.

Usage

NestedArray$flatten(order = NA)

Arguments

order

Either "C", "F", or NA.


Method flatten_to_raw()

Flatten the array contents and convert to a raw vector.

Usage

NestedArray$flatten_to_raw(order = NA)

Arguments

order

Either "C", "F", or NA.


Method as.array()

Usage

NestedArray$as.array()

Returns

array


Method clone()

The objects of this class are cloneable with this method.

Usage

NestedArray$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.