R/methods_values.R
, R/ds_heap.R
, R/ds_map_bimap.R
, and 1 more
values-methods.Rd
Extracts the values from a data structure such as a map
or heap
object.
values(obj) # S4 method for heap values(obj) # S4 method for bimap values(obj) # S4 method for unordered_map values(obj)
obj | object to extract values from |
---|
returns the extracted values as a list
or, when primitive, as
a vector
. In case of a heap
also returns key
and handle
of the heap node.
# shows the values of a hashmap h_map <- hashmap("integer") h_map <- insert(h_map, seq(2), list(data.frame(a=1), 3)) values(h_map)#> [[1]] #> [1] 3 #> #> [[2]] #> a #> 1 1 #># shows the values of a multimap m_map <- multimap("integer") m_map[seq(2)] <- list(diag(2), rnorm(3)) values(m_map)#> [[1]] #> [1] 0.84618466 0.08171963 -1.30511701 #> #> [[2]] #> [,1] [,2] #> [1,] 1 0 #> [2,] 0 1 #># shows the values of a heap f_heap <- fibonacci_heap("integer") f_heap <- insert(f_heap, 1:2, list(diag(2), rnorm(3))) values(f_heap)#> $`1` #> $`1`$handle #> [1] "handle-0" #> #> $`1`$key #> [1] 1 #> #> $`1`$value #> [,1] [,2] #> [1,] 1 0 #> [2,] 0 1 #> #> #> $`2` #> $`2`$handle #> [1] "handle-1" #> #> $`2`$key #> [1] 2 #> #> $`2`$value #> [1] -0.9449121 0.4543416 -0.8552025 #> #>