| create_nodes | R Documentation |
Build canonical node and edge tables from ordinary metadata frames.
create_nodes(
data,
type,
id_col,
label_col = NULL,
attr_cols = NULL,
prefix = TRUE,
dedupe = TRUE
)
create_edges(
data,
from_col,
to_col,
from_type,
to_type,
relation,
attr_cols = NULL,
allow_missing = FALSE,
dedupe = TRUE,
from_prefix = TRUE,
to_prefix = TRUE
)
data |
A |
type, from_type, to_type |
Supported node types such as |
id_col |
Column containing the source identifier for the node type. |
label_col |
Optional column used for node labels. |
attr_cols |
Optional columns stored in the |
prefix |
If |
dedupe |
If |
from_col, to_col |
Source and target identifier columns for edge creation. |
relation |
Canonical edge type. |
allow_missing |
If |
from_prefix, to_prefix |
Whether to prepend typed prefixes when constructing the edge endpoint identifiers. Defaults preserve the canonical prefixed-ID format. |
The package uses typed node identifiers such as sample:S1 as the
canonical graph representation. If you create node sets with
prefix = FALSE, the corresponding edge endpoints must use matching
prefix settings via from_prefix and to_prefix.
When dedupe = TRUE, exact duplicate node or edge definitions are
collapsed, but conflicting definitions for the same canonical node
identifier or edge relation are rejected with an error.
For create_nodes(), a graph_node_set. For
create_edges(), a graph_edge_set.
meta <- data.frame(
sample_id = c("S1", "S2"),
subject_id = c("P1", "P2")
)
samples <- create_nodes(meta, type = "Sample", id_col = "sample_id")
edges <- create_edges(
meta,
from_col = "sample_id",
to_col = "subject_id",
from_type = "Sample",
to_type = "Subject",
relation = "sample_belongs_to_subject"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.