Learn R Programming

automerge (version 0.3.0)

am_load_incremental: Load incremental changes into a document

Description

Applies incremental changes (from am_save_incremental()) to a document. This is more efficient than loading a full document when only a few changes need to be applied.

Usage

am_load_incremental(doc, data)

Value

The number of operations applied (numeric scalar, invisibly).

Arguments

doc

An Automerge document

data

A raw vector containing incremental changes (from am_save_incremental())

See Also

am_save_incremental(), am_load()

Examples

Run this code
doc1 <- am_create()
doc1$key <- "value"
am_commit(doc1)
bytes <- am_save(doc1)

doc1$key2 <- "value2"
am_commit(doc1)
incremental <- am_save_incremental(doc1)

# Load base document and apply incremental changes
doc2 <- am_load(bytes)
am_load_incremental(doc2, incremental)
doc2$key2  # "value2"

am_close(doc1)
am_close(doc2)

Run the code above in your browser using DataLab