Skip to content

Document Lifecycle

Create, save, load, and manage Automerge documents

am_create()
Create a new Automerge document
am_load()
Load an Automerge document from binary format
am_save()
Save an Automerge document to binary format
am_fork()
Fork an Automerge document
am_merge()
Merge changes from another document
am_commit()
Commit pending changes
am_rollback()
Roll back pending operations

Actor Management

Get and set document actor IDs

am_get_actor()
Get the actor ID of a document
am_get_actor_hex()
Get the actor ID as a hex string
am_set_actor()
Set the actor ID of a document

Object Operations

Create and manipulate maps, lists, and nested objects

am_put()
Put a value into an Automerge map or list
am_get()
Get a value from an Automerge map or list
am_delete()
Delete a key from a map or element from a list
am_insert()
Insert a value into an Automerge list
am_keys()
Get all keys from an Automerge map
am_values()
Get all values from a map or list
am_length()
Get the length of an Automerge map or list

Text Operations

Work with collaborative text objects

am_text()
Create an Automerge text object
am_text_content()
Get text content from a text object
am_text_splice()
Splice text in a text object
am_text_update()
Update text content
as.character(<am_text>)
Convert text object to character string

Counters

Create and increment CRDT counters

am_counter()
Create an Automerge counter
am_counter_increment()
Increment a counter value

Cursors and Marks

Stable positions and text formatting

am_cursor()
Create a cursor at a position in a text object
am_cursor_position()
Get the current position of a cursor
am_mark()
Create a mark on a text range
am_marks()
Get all marks in a text object
am_marks_at()
Get marks at a specific position

Synchronization

Sync documents across peers

am_sync()
Bidirectional synchronization
am_sync_state_new()
Create a new sync state
am_sync_encode()
Generate a sync message
am_sync_decode()
Receive and apply a sync message

History and Changes

Track document history and changes

am_get_heads()
Get the current heads of a document
am_get_changes()
Get changes since specified heads
am_get_history()
Get document history
am_apply_changes()
Apply changes to a document
am_get_last_local_change()
Get the last change made by the local actor
am_get_change_by_hash()
Get a specific change by its hash
am_get_changes_added()
Get changes in one document that are not in another

Type Constructors

Explicit type constructors for objects

am_list()
Create an Automerge list
am_map()
Create an Automerge map
am_uint64()
Create an unsigned 64-bit integer value

Path-Based Access

Navigate deep nested structures

am_get_path()
Navigate deep structures with path
am_put_path()
Set value at path
am_delete_path()
Delete value at path

Conversion Helpers

Convert between R lists and Automerge documents

as_automerge()
Convert R list to Automerge document
from_automerge()
Convert Automerge document to R list

Constants

Package constants and enumerations

S3 Methods

R methods for Automerge objects

`[[`(<am_doc>) `$`(<am_doc>)
Extract from Automerge document root
`[[<-`(<am_doc>) `$<-`(<am_doc>)
Replace in Automerge document root
`[[`(<am_object>) `$`(<am_object>)
Extract from Automerge object
`[[<-`(<am_object>) `$<-`(<am_object>)
Replace in Automerge object
length(<am_doc>)
Get length of document root
length(<am_object>)
Get length of Automerge object
names(<am_doc>)
Get names from document root
names(<am_map>)
Get names from Automerge map object
as.list(<am_doc>)
Convert document root to R list