Erase a vector of key-value pair from a map object.

erase(obj, key, value)

# S4 method for map,vector,missing
erase(obj, key)

# S4 method for bimap,missing,vector
erase(obj, value)

# S4 method for multimap,vector,vector
erase(obj, key, value)

# S4 method for multimap,vector,list
erase(obj, key, value)

# S4 method for multimap,vector,ANY
erase(obj, key, value)

Arguments

obj

the object to pop an element from

key

a vector of keys that should be removed

value

optionally a list of values needs to be supplied for some data structures such as multimaps if a single key-value pair should removed. If not provided removes all key-value pairs with a specific key.

Value

returns obj with removed values

Examples

# erases keys from a hashmap or bimap h_map <- hashmap() h_map[letters] <- rnorm(length(letters)) h_map <- erase(h_map, "a") h_map <- erase(h_map, letters[2:5]) # erases keys from a multimap m_map <- multimap() m_map[c("a", "a", "a", "b", "b", "c")] <- rep(1:2, 3) m_map <- erase(m_map, "a")
#> Note: method with signature ‘map#vector#missing’ chosen for function ‘erase’, #> target signature ‘multimap#character#missing’. #> "multimap#vector#ANY" would also be valid
m_map <- erase(m_map, "b", 1)