auto_clear_lazyarray {lazyarray} | R Documentation |
Automatically remove array data
Description
Remove the files containing array data once no
'lazyarray' instance is using the folder. Require
installation of dipsaus
package (at least version 0.0.8).
Usage
auto_clear_lazyarray(x, onexit = FALSE)
Arguments
x |
'lazyarray' instance |
onexit |
passed to |
Details
auto_clear_lazyarray
attempts to remove the entire folder
containing array data. However, if some files are not created by the
array, only partition data and meta file will be removed, all the
artifacts will remain and warning will be displayed. One exception is
if all files left in the array directory are *.meta
files,
all these meta files will be removed along with the folder.
Author(s)
Zhengjia Wang
Examples
path <- tempfile()
arr_dbl <- lazyarray(path, storage_format = 'double',
dim = 2:4, meta_name = 'meta-dbl.meta')
arr_dbl[] <- 1:24
auto_clear_lazyarray(arr_dbl)
arr_chr <- lazyarray(path, storage_format = 'character',
dim = 2:4, meta_name = 'meta-chr.meta',
quiet = TRUE)
auto_clear_lazyarray(arr_chr)
# remove either one, the directory still exists
rm(arr_dbl); invisible(gc(verbose = FALSE))
arr_chr[1,1,1]
# Remove the other one, and path will be removed
rm(arr_chr); invisible(gc(verbose = FALSE))
dir.exists(path)
arr_check <- lazyarray(path, storage_format = 'character',
dim = 2:4, meta_name = 'meta-chr',
quiet = TRUE)
# data is removed, so there should be no data (NAs)
arr_check[]
[Package lazyarray version 1.1.0 Index]