| insert | R Documentation |
Add elements to a container by reference.
insert(x, values, keys = NULL, position = NULL)
x |
A CppSet, CppUnorderedSet, CppMultiset, CppUnorderedMultiset, CppMap, CppUnorderedMap, CppMultimap, CppUnorderedMultimap, CppVector, CppDeque, or CppList object. |
values |
Values to add to |
keys |
Keys to add to |
position |
Index at which to insert elements into |
Existing container values are not overwritten. I.e. inserting a key-value pair into a map that already contains that key preserves the old value and discards the new one. Use insert_or_assign to overwrite values.
Invisibly returns NULL.
assign, emplace, insert_after, insert_or_assign, push.
s <- cpp_multiset(4:6)
s
# 4 5 6
insert(s, 6:7)
s
# 4 5 6 6 7
m <- cpp_map(c("hello", "there", "world"), 9:11)
m
# ["hello",9] ["there",10] ["world",11]
insert(m, 12L, "there")
m
# ["hello",9] ["there",10] ["world",11]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.