h5WriteScalar | R Documentation |
Low-level helper function to write scalar R data into HDF5 dataset. Data will be written into scalar space instead of array space.
h5WriteScalar(x, name, robj, ...)
## S3 method for class 'H5Group'
h5WriteScalar(x, name, robj, stype = c("utf8", "ascii7"), ...)
## S3 method for class 'H5File'
h5WriteScalar(x, name, robj, ...)
## S3 method for class 'character'
h5WriteScalar(x, name, robj, overwrite = FALSE, ...)
x |
An |
name |
Name of an HDF5 link. |
robj |
A scalar object. |
... |
Arguments passed to |
stype |
'utf8' or 'ascii7'. Passed to |
overwrite |
Whether or not to overwrite the existing |
This is an operation function and no return. Any failure should raise an error.
If you want to write robj
into array space, you should use
h5WriteDataset
.
tmp.file <- tempfile(fileext = ".h5")
h5CreateFile(tmp.file)
h5WriteScalar(tmp.file, name = "test/scalar", TRUE)
x <- h5ReadDataset(tmp.file, name = "test/scalar")
x
h5WriteScalar(tmp.file, name = "test/scalar", 100.0, overwrite = TRUE)
x <- h5ReadDataset(tmp.file, name = "test/scalar")
x
h5WriteScalar(tmp.file, name = "test/scalar", "ABC", overwrite = TRUE)
x <- h5Read(tmp.file, name = "test/scalar")
x
h5WriteScalar(tmp.file, name = "test/factor", factor("ABC"))
x <- h5ReadDataset(tmp.file, name = "test/factor")
x
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.