doc <- am_create()
am_put(doc, AM_ROOT, "key", "value")
am_commit(doc, "Add key")
history <- am_get_changes(doc)
bytes <- am_change_to_bytes(history[[1]])
bytes
# Round-trip
restored <- am_change_from_bytes(bytes)
identical(am_change_to_bytes(restored), bytes) # TRUE
am_close(doc)
Run the code above in your browser using DataLab