R/methods_erase.R
, R/ds_map.R
, R/ds_map_bimap.R
, and 1 more
erase-methods.Rd
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)
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 |
returns obj
with removed values
# 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")#>#> #>m_map <- erase(m_map, "b", 1)