Learn R Programming

automerge (version 0.3.0)

am_items: Get full item details from an object

Description

Returns detailed information about each entry in a map or list, including the key (or index) and value for each item. This provides more information than am_values() alone.

Usage

am_items(doc, obj, heads = NULL)

Value

A list of lists, where each inner list has fields:

key

For maps: the character key. For lists: the 1-based integer index.

value

The value at this entry.

Arguments

doc

An Automerge document

obj

An Automerge object ID, or AM_ROOT for the document root

heads

Optional list of change hashes (raw vectors) for historical query. If NULL (default), uses the current state.

Examples

Run this code
doc <- am_create()
doc$name <- "Alice"
doc$age <- 30L

items <- am_items(doc, AM_ROOT)
items[[1]]$key    # "age" (sorted lexicographically)
items[[1]]$value  # 30

am_close(doc)

Run the code above in your browser using DataLab