Learn R Programming

zarr (version 0.1.1)

array-indexing: Extract or replace parts of a Zarr array

Description

These operators can be used to extract or replace data from an array by indices. Normal R array selection rules apply. The only limitation is that the indices have to be consecutive.

Usage

# S3 method for zarr_array
[(x, ..., drop = TRUE)

Value

When extracting data, a vector, matrix or array, having dimensions as specified in the indices. When replacing part of the Zarr array, returns x invisibly.

Arguments

x

A zarr_array object of which to extract or replace the data.

...

Indices specifying elements to extract or replace. Indices are numeric, empty (missing) or NULL. Numeric values are coerced to integer or whole numbers. The number of indices has to agree with the dimensionality of the array.

drop

If TRUE (the default), degenerate dimensions are dropped, if FALSE they are retained in the result.

Examples

Run this code
x <- array(1:100, c(10, 10))
z <- as_zarr(x)
arr <- z[["/"]]
arr[3:5, 7:9]

Run the code above in your browser using DataLab