View source: R/unordered_multimap.R
| cpp_unordered_multimap | R Documentation |
Create an unordered multimap. Unordered multimaps are key-value pairs with non-unique keys.
cpp_unordered_multimap(keys, values)
keys |
An integer, numeric, character, or logical vector. |
values |
An integer, numeric, character, or logical vector. |
Unordered multimaps are associative containers. They do not provide random access through an index. I.e. m[2] does not return the second
element.
Unordered means that the container does not enforce elements to be stored in a particular order. This makes unordered multimaps in some applications faster than multimaps.
C++ unordered_multimap methods implemented in this package are bucket_count, clear, contains, count, emplace, empty, erase, insert, load_factor, max_bucket_count, max_load_factor, max_size, merge, rehash, reserve, and size. The package also adds the == operator and various helper functions (print, to_r, type).
All object-creating methods in this package begin with cpp_ to avoid clashes with functions from other packages, such as utils::stack and
base::vector.
Returns a CppUnorderedMultimap object referencing an unordered_multimap in C++.
cpp_map, cpp_unordered_map, cpp_multimap.
m <- cpp_unordered_multimap(c("world", "hello", "there", "hello"), 4:7)
m
# ["there",6] ["hello",5] ["hello",7] ["world",4]
print(m, n = 2)
#
erase(m, "hello")
m
# ["there",6] ["world",4]
contains(m, "there")
# [1] TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.