Write data to dataset
Arguments
- h5dataset
Object of class H5IdComponent representing an open HDF5 dataset.
- buf
The R object containing the data to be written to the dataset.
- h5type
Datatype of the HDF5 dataset to be written. If left as
NULLit will use the dataype of the R object supplied tobuf.- h5spaceMem, h5spaceFile
H5IdComponent objects representing the memory and file dataspaces respectively. If these are left
NULLdataspaces that match the size and shape ofh5datasetwill be used.
Examples
h5file <- tempfile(fileext = ".h5")
h5createFile(h5file)
fid <- H5Fopen(h5file)
H5Dcreate(h5loc = fid, name = "A", dtype_id = "H5T_NATIVE_INT", h5space = H5Screate_simple(10))
did <- H5Dopen(h5loc = fid, name = "A")
H5Dwrite(h5dataset = did, buf = 1:10)
H5Dread(did)
#> [1] 1 2 3 4 5 6 7 8 9 10
## remember to close open handles
H5Dclose(did)
H5Fclose(fid)