| write_caugi | R Documentation |
Writes a caugi graph to a file in the native caugi JSON format. This format is designed for reproducibility, caching, and sharing caugi graphs across R sessions.
write_caugi(x, path, comment = NULL, tags = NULL)
x |
A |
path |
Character string specifying the file path. |
comment |
Optional character string with a comment about the graph. |
tags |
Optional character vector of tags for categorizing the graph. |
The caugi format is a versioned JSON schema that captures:
Graph structure (nodes and edges with their types)
Graph class (DAG, PDAG, ADMG, UG, etc.)
Optional metadata (comments and tags)
Edge types are encoded using their DSL operators (e.g., "-->", "<->", "--").
For a complete guide to the format, see vignette("serialization", package = "caugi").
The formal JSON Schema is available at:
https://caugi.org/schemas/caugi-v1.schema.json
Invisibly returns the input x.
Other export:
caugi_deserialize(),
caugi_dot(),
caugi_export(),
caugi_graphml(),
caugi_mermaid(),
caugi_serialize(),
export-classes,
format-caugi,
format-dot,
format-graphml,
format-mermaid,
knit_print.caugi_export(),
read_caugi(),
read_graphml(),
to_dot(),
to_graphml(),
to_mermaid(),
write_dot(),
write_graphml(),
write_mermaid()
cg <- caugi(
A %-->% B + C,
B %-->% D,
C %-->% D,
class = "DAG"
)
# Write to file
tmp <- tempfile(fileext = ".caugi.json")
write_caugi(cg, tmp, comment = "Example DAG")
# Read back
cg2 <- read_caugi(tmp)
identical(edges(cg), edges(cg2))
# Clean up
unlink(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.