View source: R/compress_incremental.R
compress_incremental | R Documentation |
save_objects
with incremental=TRUE
This function is only intended to be used after save_objects
with incremental=TRUE
. In this case, save_objects
with save results under temporary hashes in a folder with the hash corresponding the the parameters. compress_incremental
then combines the results and saves them under the corresponding hash and deletes the old directory with the temporary results.
compress_incremental(
folder,
parameters_list,
hash_includes_timestamp = FALSE,
ignore_na = TRUE,
alphabetical_order = TRUE,
algo = "xxhash64",
ignore_script_name = FALSE,
remove_folder = TRUE
)
folder |
Character string specifying the path to the directory where the temporary folder was saved (should be the same as supplied to |
parameters_list |
The named list of arguments used with |
hash_includes_timestamp |
Logical. If |
ignore_na |
Logical. If |
alphabetical_order |
Logical. If |
algo |
Character string specifying the hashing algorithm to use. Default is |
ignore_script_name |
Logical. If |
remove_folder |
Logical. If |
If the individual results can be put into a data.frame
they will be, otherwise they will be stored as a list.
No return value. This function is called for its side effects.
save_objects()
## Save results incrementally
params <- list(a = "1", b = "2")
tmp_dir <- file.path(tempdir(), "example")
dir.create(tmp_dir)
for (i in 1:10) {
save_objects(tmp_dir, data.frame(idx = i, val = rnorm(1)), params, incremental = TRUE)
}
## See contents of tmp directory for incremental file
list.files(file.path(tmp_dir, generate_hash(params)))
## Compress results into a single file
compress_incremental(tmp_dir, params)
list.files(tmp_dir)
## Read in compressed file and view results
read_objects(tmp_dir, params)
## Cleanup
unlink(tmp_dir, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.