# NOT RUN {
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[]
# }
Run the code above in your browser using DataLab