list_dec: Create Decoration's Graphs and Store them in a List

View source: R/list_dec.R

list_decR Documentation

Create Decoration's Graphs and Store them in a List

Description

Create undirected graphs for each decoration from nodes, edges and imgs dataframes and store the graphs in a list. The join between these dataframes is done on the two fields site and decor. Graph names refer to imgs$idf.

Usage

list_dec(imgs, nodes, edges)

Arguments

imgs

dataframe of decorations.

nodes

dataframe of nodes.

edges

dataframe of edges.

Value

A list of igraph graphs.

See Also

graph_from_data_frame

Examples


# Read imgs, nodes and edges dataframes
imgs <- read.csv2(system.file("extdata", "imgs.tsv", package = "iconr"),
                  sep="\t", stringsAsFactors = FALSE)
nodes <- read.csv2(system.file("extdata", "nodes.tsv", package = "iconr"),
                   sep="\t", stringsAsFactors = FALSE)
edges <- read.csv2(system.file("extdata", "edges.tsv", package = "iconr"),
                   sep="\t", stringsAsFactors = FALSE)
# Create the list of graphs
lgrph <- list_dec(imgs, nodes, edges)

# Get the first graph
g <- lgrph[[1]]
g

# Graph name
g$name

# Graph label
g$lbl

# Graph number of nodes
igraph::gorder(g)

# Graph number of edges
igraph::gsize(g)


zoometh/iconr documentation built on Nov. 9, 2023, 10:01 a.m.