doc <- am_create()
am_put(doc, AM_ROOT, "key", "value")
am_commit(doc, "Add key")
# Serialize a change and restore it
history <- am_get_changes(doc)
bytes <- am_change_to_bytes(history[[1]])
change <- am_change_from_bytes(bytes)
change
am_change_message(change) # "Add key"
am_close(doc)
Run the code above in your browser using DataLab