| close.HDF5Matrix | R Documentation |
Close an HDF5Matrix object and release file resources immediately. This is the standard R interface for resource cleanup.
## S3 method for class 'HDF5Matrix'
close(con, ...)
con |
An |
... |
Additional arguments (currently ignored) |
Closes the HDF5 dataset without waiting for garbage collection.
After calling close(), is_valid() returns FALSE and
any further operations on the object will fail. The file is immediately
accessible by other tools such as HDFView.
Both syntaxes work:
close(X) - Standard R generic (recommended)
X$close() - R6 method (still supported)
For emergency closure of all open HDF5 objects in the session, see
hdf5_close_all.
Invisible NULL
hdf5_matrix for opening datasets,
hdf5_close_all for closing all open objects
tmp <- tempfile(fileext = ".h5")
X <- hdf5_create_matrix(tmp, "data/matrix", data = matrix(rnorm(100), 10, 10))
# Open matrix
X <- hdf5_matrix(tmp, "data/matrix")
data <- X[1:5, 1:5]
# Close using S3 method (recommended)
close(X)
# Or using R6 method (still works)
# X$close()
X$is_valid() # FALSE
unlink(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.