View source: R/cleanup_from_hash_table.R
cleanup_from_hash_table | R Documentation |
Allows the user to leverage the generate_hash
function to generate a table that is subsequently used to remove indicated results.
cleanup_from_hash_table(
folder,
hash_table,
mode = c("manual", "all"),
column = NULL,
request_confirmation = TRUE
)
folder |
A string specifying the directory containing the RDS files. |
hash_table |
A |
mode |
A character string. When |
column |
A character string indicating the logical column in |
request_confirmation |
Logical, if TRUE will request user input before proceeding to delete files. |
There are a few ways to use this. When mode = "manual"
(default) the function expects that the user will add a column to a hash table that indicated which files to delete. When mode = "all"
, any results in the hash table will be removed. This is generally only used when a filter_list
is passed to create_hash_table
.
Nothing, this function is called for its side effects.
create_hash_table()
## Setup
tmp_dir <- file.path(tempdir(), "example")
dir.create(tmp_dir)
## Save example objects
parameters_list1 <- list(example = "tagging1")
parameters_list2 <- list(example = "tagging2")
save_objects(folder = tmp_dir, results = 1, parameters_list = parameters_list1)
save_objects(folder = tmp_dir, results = 2, parameters_list = parameters_list2)
## See the files saved
list.files(tmp_dir)
## Create hash table (flat file of result parameters)
hash_table <- create_hash_table(folder = tmp_dir)
## Delete "all" files based on hash table, without confirmation
cleanup_from_hash_table(
folder = tmp_dir, hash_table = hash_table, mode = "all", request_confirmation = FALSE
)
## See the files have been deleted
list.files(tmp_dir)
## Cleanup
unlink(tmp_dir, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.