| am_insert | R Documentation |
This is an alias for am_put() with insert semantics for lists.
For lists, am_put() with a numeric index replaces the element
at that index, while am_insert() shifts elements to make room.
am_insert(doc, obj, pos, value)
doc |
An Automerge document |
obj |
An Automerge object ID (must be a list) |
pos |
Numeric index (1-based, like R vectors) where to insert, or |
value |
The value to insert |
The document doc (invisibly)
doc <- am_create()
# Create a list and get it
am_put(doc, AM_ROOT, "items", AM_OBJ_TYPE_LIST)
items <- am_get(doc, AM_ROOT, "items")
# Insert items
am_insert(doc, items, "end", "first")
am_insert(doc, items, "end", "second")
am_close(doc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.