| LazyH5 | R Documentation |
provides hybrid data structure for 'HDF5' file
none
self instance
self instance
subset of data
dimension of the array
data type, currently only character, integer, raw, double, and complex are available, all other types will yield "unknown"
quietwhether to suppress messages
finalize()garbage collection method
LazyH5$finalize()
print()overrides print method
LazyH5$print()
new()constructor
LazyH5$new(file_path, data_name, read_only = FALSE, quiet = FALSE)
file_pathwhere data is stored in 'HDF5' format
data_namethe data stored in the file
read_onlywhether to open the file in read-only mode. It's highly recommended to set this to be true, otherwise the file connection is exclusive.
quietwhether to suppress messages, default is false
save()save data to a 'HDF5' file
LazyH5$save( x, chunk = "auto", level = 7, replace = TRUE, new_file = FALSE, force = TRUE, ctype = NULL, size = NULL, ... )
xvector, matrix, or array
chunkchunk size, length should matches with data dimension
levelcompress level, from 1 to 9
replaceif the data exists in the file, replace the file or not
new_fileremove the whole file if exists before writing?
forceif you open the file in read-only mode, then saving
objects to the file will raise error. Use force=TRUE to force
write data
ctypedata type, see mode, usually the data type
of x. Try mode(x) or storage.mode(x) as hints.
sizedeprecated, for compatibility issues
...passed to self open() method
open()open connection
LazyH5$open(new_dataset = FALSE, robj, ...)
new_datasetonly used when the internal pointer is closed, or to write the data
robjdata array to save
...passed to createDataSet in hdf5r package
close()close connection
LazyH5$close(all = TRUE)
allwhether to close all connections associated to the data file. If true, then all connections, including access from other programs, will be closed
subset()subset data
LazyH5$subset(..., drop = FALSE, stream = FALSE, envir = parent.frame())
dropwhether to apply drop the subset
streamwhether to read partial data at a time
envirif i,j,... are expressions, where should the
expression be evaluated
i, j, ...index along each dimension
get_dims()get data dimension
LazyH5$get_dims(stay_open = TRUE)
stay_openwhether to leave the connection opened
get_type()get data type
LazyH5$get_type(stay_open = TRUE)
stay_openwhether to leave the connection opened
Zhengjia Wang
# Data to save
x <- array(rnorm(1000), c(10,10,10))
# Save to local disk
f <- tempfile()
save_h5(x, file = f, name = 'x', chunk = c(10,10,10), level = 0)
# Load via LazyFST
dat <- LazyH5$new(file_path = f, data_name = 'x', read_only = TRUE)
dat
# Check whether the data is identical
range(dat - x)
# Read a slice of the data
system.time(dat[,10,])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.