Learn R Programming

hashmap (version 0.2.2)

load_hashmap: Load Hashmaps

Description

load_hashmap reads a file created by a call to save_hashmap and returns a Hashmap object.

Usage

load_hashmap(file)

Arguments

file

the name of a file previously created by a call to save_hashmap.

Value

A Hashmap object on success; an error on failure.

Details

The object returned will contain all of the same key-value pairs that were present in the original Hashmap at the time save_hashmap was called, but they are not guaranteed to be in the same order, due to rehashing.

See Also

save_hashmap

Examples

Run this code
# NOT RUN {
H <- hashmap(sample(letters[1:10]), sample(1:10))
tf <- tempfile()

save_hashmap(H, tf)

H2 <- load_hashmap(tf)
all.equal(
    sort(H$find(H2$keys())),
    sort(H2$values())
)

all.equal(
    H$data.frame(),
    readRDS(tf)
)
# }

Run the code above in your browser using DataLab