Skip to contents

This generic returns the HDF5 file object associated with the object.

Usage

h5file(x)

Arguments

x

The object from which to retrieve the HDF5 file object

Value

The HDF5 file object (from package hdf5r)

Examples

if (FALSE) { # \dontrun{
if (!is.null(fmristore:::create_minimal_h5_for_H5ClusterExperiment)) {
  temp_exp_file <- NULL
  exp_obj <- NULL
  tryCatch({
    temp_exp_file <- fmristore:::create_minimal_h5_for_H5ClusterExperiment()
    exp_obj <- fmristore::H5ClusterExperiment(file_path = temp_exp_file)

    # Get the H5File object
    h5f <- h5file(exp_obj)
    print(h5f)
    # if (requireNamespace("hdf5r", quietly = TRUE)) print(h5f$is_valid)

  }, error = function(e) {
    message("h5file example failed: ", e$message)
  }, finally = {
    # Closing exp_obj will close the h5file handle it owns
    if (!is.null(exp_obj)) try(close(exp_obj), silent = TRUE)
    if (!is.null(temp_exp_file) && file.exists(temp_exp_file)) {
      unlink(temp_exp_file)
    }
  })
} else {
  message("Skipping h5file example: helper not available.")
}
} # }