# Create two independent documents
doc1 <- am_create()
doc1$x <- 1
am_commit(doc1, "Add x")
doc2 <- am_create()
doc2$y <- 2
am_commit(doc2, "Add y")
# Find changes in doc2 that aren't in doc1
changes <- am_get_changes_added(doc1, doc2)
changes
length(changes) # 1 change
# Apply those changes to doc1
am_apply_changes(doc1, changes)
# Now doc1 has both x and y
names(doc1) # "x" "y"
am_close(doc1)
am_close(doc2)
Run the code above in your browser using DataLab