Learn R Programming

rhdf5 (version 2.16.0)

rhdf5: 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.

Arguments

Package content

HDF5 file, group, dataset creation HDF5 file content listing Reading and writing data HDF5 constants HDF5 version number Low level interface to HDF5 C-library (for expert users only!):

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

Run this code
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))

Run the code above in your browser using DataLab