DrawingNetworks: Helper functions for drawing networks

Description Usage Arguments Value

Description

These functions translate an edge list into a positioned node list, and augment the edge list with the positions in the node list. Suppose you have only an edges file Edge with columns from, to, strength, age. Make the corresponding Vertex file: V <- edgesToVertices( Edge, from=from,to=to ) V will be a vertices file with x and y assigned Or, if you already have a V with x and y, skip the edgesToVertices step. Now augment the Edge dataframe with the positions x, y, xend, yend E <- edgesForPlotting( V, ID=ID, x=x, y=y, Edges, from=from, to=to) Now you can plot E and V ggplot() + geom_segment(E,aes(x=x,y=y,yend=yend,xend=xend)) + geom_point( V, aes(x=x,y=y) ) + geom_text( V, aes(x=x,y=y,label=ID))

Usage

1
2
3
edgesToVertices(Edges, from, to)

edgesForPlotting(Vertices, ID, x, y, Edges, from, to)

Arguments

Edges

dataframe containing the from and to connection for each edge. from and to should be drawn from the same set as ID in Vertices.

from

Name of the <from> variable in the edgelist

to

Name of the <from> variable in the edgelist

Vertices

a data frame containing vertex IDs and x,y coordinates for each vertex.

ID

variable containing the ID of the vertices

x

variable holding x-position of vertex

y

variable holding y-position of vertex

Value

A data frame containing all the vertex IDs, with x and y positions for each one.


dtkaplan/DataComputing documentation built on May 15, 2019, 4:58 p.m.