| save_hashmap {hashmap} | R Documentation |
save_hashmap writes a Hashmap's data to the
specified file, which can be passed to load_hashmap at a
later point in time to recreate the object.
save_hashmap(x, file, overwrite = TRUE, compress = FALSE)
x |
an object created by a call to |
file |
a filename where the object's data will be saved. |
overwrite |
if |
compress |
a logical value or the type of file compression to use;
defaults to |
Saving is done by calling base::saveRDS on the object's
data.frame representation, x$data.frame(). Attempting to
save an empty Hashmap results in an error.
Nothing on success; an error on failure.
H <- hashmap(sample(letters[1:10]), sample(1:10))
tf <- tempfile()
save_hashmap(H, tf)
inherits(
try(save_hashmap(H, tf, FALSE), silent = TRUE),
"try-error"
)
H$insert("zzzzz", 123L)
save_hashmap(H, tf)
load_hashmap(tf)