| as_automerge | R Documentation |
Converts an R list to an Automerge document. This leverages the recursive
conversion built into am_put() from Phase 3, allowing nested structures
to be created in a single call.
as_automerge(x, doc = NULL, actor_id = NULL)
x |
R list, vector, or scalar value to convert |
doc |
Optional existing Automerge document. If NULL, creates a new one. |
actor_id |
Optional actor ID for new documents (raw bytes or hex string) |
An Automerge document
# Convert nested list to Automerge
data <- list(
name = "Alice",
age = 30L,
scores = list(85, 90, 95),
metadata = list(
created = Sys.time(),
tags = list("user", "active")
)
)
doc <- as_automerge(data)
doc[["name"]] # "Alice"
doc[["age"]] # 30L
am_close(doc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.