| gs_features-utils | R Documentation |
Utilities for extracting and adding node-associated features stored in the
fdata container of a GraphSpace object.
gs_fetch_features(x, vars = NULL, as_df = FALSE)
gs_add_features(x, data)
x |
A |
vars |
Character vector specifying feature names to extract.
If |
as_df |
Logical. If |
data |
A matrix-like or |
gs_fetch_features() returns a matrix-like object or
data.frame containing the selected node features.
gs_add_features() returns a modified
GraphSpace object.
library(RGraphSpace)
# Load a demo igraph and create a GraphSpace object
data('gtoy1', package = 'RGraphSpace')
gs <- GraphSpace(gtoy1)
# A feature matrix with node identifiers as row names
feats <- matrix(as.numeric(seq_len(gs_vcount(gs) * 3)), ncol = 3,
dimnames = list(names(gs), c("geneA", "geneB", "geneC")))
# Add features (rows are matched and reordered to the nodes)
gs <- gs_add_features(gs, feats)
gs_features(gs)
# Fetch all features, or a subset as a data.frame
gs_fetch_features(gs)
gs_fetch_features(gs, vars = c("geneA", "geneC"), as_df = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.