h5read (file, name, index=NULL, start=NULL, stride=NULL, block=NULL, count=NULL, compoundAsDataFrame = TRUE, callGeneric = TRUE,
read.attributes = FALSE, ...)
h5readAttributes (file, name)
h5write (obj, file, name, ...)
h5write.default (obj, file, name, createnewfile = TRUE, write.attributes = FALSE, ...)
h5writeDataset (obj, h5loc, name, ...)
h5writeDataset.data.frame (obj, h5loc, name, level=7, DataFrameAsCompound = TRUE)
h5writeDataset.list (obj, h5loc, name, level=7)
h5writeDataset.matrix (...)
h5writeDataset.integer (...)
h5writeDataset.double (...)
h5writeDataset.logical (...)
h5writeDataset.character (...)
h5writeDataset.array (obj, h5loc, name, index = NULL, start=NULL, stride=NULL, block=NULL, count=NULL, size=NULL, level=7)
h5writeAttribute (attr, h5obj, name, ...)
h5writeAttribute.matrix (...)
h5writeAttribute.integer (...)
h5writeAttribute.double (...)
h5writeAttribute.logical (...)
h5writeAttribute.character (...)
h5writeAttribute.array (attr, h5obj, name, size)H5IdComponent representing a H5 location identifier (file or group). See H5Fcreate, H5Fopen, H5Gcreate, H5Gopen to create an object of this kind.H5IdComponent representing a H5 location identifier (file or group). See H5Fcreate, H5Fopen, H5Gcreate, H5Gopen to create an object of this kind.h5createDataset to create an dataset.obj are written to the HDF5 file.H5Dread.h5read returns an array with the data read.h5readAttributes returns a list of all HDF5 attributes of object name.h5write returns 0 if successful.
start, stride, block, count is specified, the dataset has the same dimension in the HDF5 file and in memory. If the dataset already exists in the HDF5 file, one can read/write subarrays, so called hyperslabs from/to the HDF5 file. The arguments start, stride, block, count define the subset of the dataset in the HDF5 file that is to be read/written. See these introductions to hyperslabs: http://www.hdfgroup.org/HDF5/Tutor/selectsimple.html, http://www.hdfgroup.org/HDF5/Tutor/select.html and http://ftp.hdfgroup.org/HDF5/Tutor/phypecont.html. Please note that in R the first dimension is the fastest changing dimension.When viewing the HDF5 datasets with any C-program (e.g. HDFView), the order of dimensions is inverted. In the R interface counting starts with 1, whereas in the C-programs (e.g. HDFView) counting starts with 0.
h5ls, h5createFile, h5createDataset, rhdf5
h5createFile("ex_hdf5file.h5")
# 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","B")
# read a matrix
E = h5read("ex_hdf5file.h5","B")
# write and read submatrix
h5createDataset("ex_hdf5file.h5", "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="S", index=list(NULL,1))
h5read("ex_hdf5file.h5", "S")
h5read("ex_hdf5file.h5", "S", index=list(NULL,2:3))
# list content of hdf5 file
h5ls("ex_hdf5file.h5")
Run the code above in your browser using DataLab