hdf5_reduce: Reduce all datasets in an HDF5 group by a binary operation

View source: R/S3_standalone.R

hdf5_reduceR Documentation

Reduce all datasets in an HDF5 group by a binary operation

Description

Applies a binary reduction ("+" or "-") across all datasets stored in a given HDF5 group and writes the result as a new dataset. Delegates to bdReduce_hdf5_dataset().

Usage

hdf5_reduce(
  filename,
  group,
  func = "+",
  outgroup = NULL,
  outdataset = NULL,
  overwrite = FALSE,
  remove = FALSE
)

Arguments

filename

Path to the HDF5 file.

group

Group path containing the datasets to reduce.

func

Character. Reduction operator: "+" (default) or "-".

outgroup

Character or NULL. Output group (default: same as group).

outdataset

Character or NULL. Output dataset name (default: same as group).

overwrite

Logical. Overwrite existing output dataset.

remove

Logical. Remove input datasets after reduction.

Value

An HDF5Matrix pointing to the result dataset.

See Also

hdf5_apply, cbind.HDF5Matrix

Examples


fn <- tempfile(fileext = ".h5")
hdf5_create_matrix(fn, "blocks/A", data = matrix(1:6, 2, 3))
hdf5_create_matrix(fn, "blocks/B", data = matrix(1:6, 2, 3))
hdf5_create_matrix(fn, "blocks/C", data = matrix(1:6, 2, 3))
result <- hdf5_reduce(fn, group = "blocks", func = "+")
as.matrix(result)
hdf5_close_all()
unlink(fn)



BigDataStatMeth documentation built on May 15, 2026, 1:07 a.m.