Learn R Programming

automerge (version 0.2.1)

am_merge: Merge changes from another document

Description

Merges all changes from another Automerge document into this one. This is a one-way merge: changes flow from other into doc, but other is not modified. For bidirectional synchronization, use am_sync().

Usage

am_merge(doc, other)

Value

The target document doc (invisibly)

Arguments

doc

Target document (will receive changes)

other

Source document (provides changes)

Examples

Run this code
doc1 <- am_create()
doc2 <- am_create()

# Make changes in each document
am_put(doc1, AM_ROOT, "x", 1)
am_put(doc2, AM_ROOT, "y", 2)

# Merge doc2's changes into doc1
am_merge(doc1, doc2)

# Now doc1 has both x and y
am_close(doc1)
am_close(doc2)

Run the code above in your browser using DataLab