Learn R Programming

automerge (version 0.3.0)

am_length: Get the length of an Automerge map or list

Description

Returns the number of key-value pairs in a map or elements in a list.

Usage

am_length(doc, obj)

Value

Integer length/size

Arguments

doc

An Automerge document

obj

An Automerge object ID, or AM_ROOT for the document root

Examples

Run this code
doc <- am_create()

am_put(doc, AM_ROOT, "a", 1)
am_put(doc, AM_ROOT, "b", 2)

len <- am_length(doc, AM_ROOT)
len  # 2

am_close(doc)

Run the code above in your browser using DataLab