| hdf5_close_all | R Documentation |
Finds and closes all HDF5Matrix objects in the specified environment.
hdf5_close_all(envir = .GlobalEnv, verbose = TRUE)
envir |
Environment to search (default: .GlobalEnv) |
verbose |
Show details (default: TRUE) |
This function:
Searches for HDF5Matrix objects in the environment
Calls $close() on each valid object
Forces garbage collection
Reports closed files
Note: Only finds objects in the specified environment. Objects inside functions or other environments are not affected.
Invisible vector of closed filenames
tmp1 <- tempfile(fileext = ".h5")
tmp2 <- tempfile(fileext = ".h5")
X <- hdf5_create_matrix(tmp1, "data/A", data = matrix(rnorm(100), 10, 10))
Y <- hdf5_create_matrix(tmp2, "data/B", data = matrix(rnorm(100), 10, 10))
X <- hdf5_matrix(tmp1, "data/A")
Y <- hdf5_matrix(tmp2, "data/B")
# Both open
X$is_valid() # TRUE
Y$is_valid() # TRUE
# Close all at once
hdf5_close_all()
# Both closed
X$is_valid() # FALSE
Y$is_valid() # FALSE
# Cleanup
unlink(c(tmp1, tmp2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.