summary_plot_rwr_attributes | R Documentation |
Based on the results of
rwr_find_seeds_between_attributes
which identify the
closest k neighbors from a seed, this function returns a barplot of the node
types (layers) reached for each seed.
summary_plot_rwr_attributes(
X,
color = NULL,
seed.id = NULL,
seed.type = NULL,
plot = TRUE
)
X |
a 'rwr.attributes' or 'list.rwr.attributes' object from rwr_find_seeds_between_attributes() |
color |
(optional) a named character vector or list, list of color to apply to each type |
seed.id |
(optional) a character vector, to filter the results and filter on specific seeds IDs |
seed.type |
(optional) a character vector, to filter the results and filter on specific seeds types |
plot |
logical, if TRUE then the plot is produced |
a 'ggplot' object
random_walk_restart
,
rwr_find_seeds_between_attributes
graph1 <- igraph::graph_from_data_frame(
list(from = c("A", "B", "A", "D", "C", "A", "C"),
to = c("B", "C", "D", "E", "D", "F", "G")),
directed = FALSE)
graph1 <- igraph::set_vertex_attr(graph = graph1,
name = 'type',
index = c("A","B","C"),
value = "1")
graph1 <- igraph::set_vertex_attr(graph = graph1,
name = 'type',
index = c("D","E"),
value = "2")
graph1 <- igraph::set_vertex_attr(graph = graph1,
name = 'type',
index = c("F", "G"),
value = "3")
rwr_res <- random_walk_restart(X = graph1,
seed = c("A", "B", "C", "D", "E"))
rwr_res_type <- rwr_find_seeds_between_attributes(X = rwr_res,
attribute = "type",
k = 3)
summary_plot_rwr_attributes(rwr_res_type)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.