| am_put | R Documentation |
Inserts or updates a value in an Automerge map or list. The function automatically dispatches to the appropriate operation based on the object type and key/position type.
am_put(doc, obj, key, value)
doc |
An Automerge document |
obj |
An Automerge object ID (from nested object), or |
key |
For maps: character string key. For lists: numeric index
(1-based) or |
value |
The value to store. Supported types:
|
The document doc (invisibly).
doc <- am_create()
# Put values in root map (returns doc invisibly)
am_put(doc, AM_ROOT, "name", "Alice")
am_put(doc, AM_ROOT, "age", 30L)
am_put(doc, AM_ROOT, "active", TRUE)
# Create nested list and retrieve it
am_put(doc, AM_ROOT, "items", AM_OBJ_TYPE_LIST)
items <- am_get(doc, AM_ROOT, "items")
am_close(doc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.