rhdf5 {rhdf5} | R Documentation

## Package overview

### Description

`rhdf5` is an interface to the HDF5 library. The R-package contains the complete HDF5 library, thus no further installation of external packages is necessary.

There are a number of high level R functions that provide a convinient way of accessing HDF5 file as well as R interfaces to a number of functions in the C-library.

### Package content

HDF5 file, group, dataset creation

- `h5createFile`

- `h5createGroup`

- `h5createDataset`

HDF5 file content listing

- `h5ls`

- `h5dump`

Reading and writing data

- `h5read`, `h5write`

- `h5dump`, `h5save`

HDF5 constants

- `h5const`, `h5default`, `h5constType`

HDF5 version number

- `h5version`

Low level interface to HDF5 C-library (for expert users only!):

- general HDF5 functions (`H5open` / `H5close` / `H5garbage_collect` / `H5get_libversion`)

- HDF5 File Interface (`H5Fcreate`, `H5Fopen` / `H5Fclose` / `H5Fflush`)

- HDF5 Group Interface (`H5Gcreate`, `H5Gcreate_anon`, `H5Gopen` / `H5Gclose` / `H5Gget_info`, `H5Gget_info_by_idx`, `H5Gget_info_by_name`)

- HDF5 Link Interface (`H5Lexists`, `H5Lget_info`)

- HDF5 Object Interface (`H5Oopen`, `H5Oclose`, `H5Oget_num_attrs`, `H5Oget_num_attrs_by_name`)

- HDF5 Identifier Interface (`H5Iget_type`, `H5Iget_name`, `H5Iis_valid`)

- HDF5 Dataset Interface (`H5Dcreate`, `H5Dopen` / `H5Dclose` / `H5Dget_space` / `H5Dread`, `H5Dwrite`)

- HDF5 Attribute Interface (`H5Acreate`, `H5Aopen`, `H5Aopen_by_idx`, `H5Aopen_by_name` / `H5Aclose`, `H5Adelete` / `H5Aexists` / `H5Aget_name`, `H5Aget_space`, `H5Aget_type` / `H5Aread`, `H5Awrite`)

- HDF5 Dataspace Interface (`H5Screate`, `H5Screate_simple`, `H5Scopy` / `H5Sclose` / `H5Sis_simple`, `H5Sget_simple_extent_dims` / `H5Sselect_hyperslab`)

- HDF5 Datatype Interface (`H5Tcopy`, `H5Tset_size`)

### Authors

R-interface by

Bernd Fischer, bernd.fischer@embl.de EMBL - European Molecular Biology Laboratory Heidelberg Germany

The package contains the HDF5 library (http://www.hdfgroup.org/HDF5).

### Examples

    h5createFile("ex_hdf5file.h5")

    # create groups
    h5createGroup("ex_hdf5file.h5","foo")
    h5createGroup("ex_hdf5file.h5","foo/foobaa")

    # write a matrix
    B = array(seq(0.1,2.0,by=0.1),dim=c(5,2,2))
    attr(B, "scale") <- "liter"
    h5write(B, "ex_hdf5file.h5","foo/B")

    # read a matrix
    E = h5read("ex_hdf5file.h5","foo/B")

    # list content of hdf5 file
    h5ls("ex_hdf5file.h5")

    # write and read submatrix
    h5createDataset("ex_hdf5file.h5", "foo/S", c(5,8), storage.mode = "integer", chunk=c(5,1), level=7)
    h5write(matrix(1:5,nr=5,nc=1), file="ex_hdf5file.h5", name="foo/S", index=list(NULL,1))
    h5read("ex_hdf5file.h5", "foo/S")
    h5read("ex_hdf5file.h5", "foo/S", index=list(2:3,2:3))

[Package rhdf5 version 2.24.0 Index]