showGraph: Plot an Aster graph object comprised of the vertice and edge...

Description Usage Arguments Value Examples

Description

Function for obtaining and plotting graph (network) objects using ggplot2 and ggnet2 functions.

Usage

1
2
showGraph(channel, graph, v = NULL, vertexWhere = graph$vertexWhere,
  edgeWhere = graph$edgeWhere, ..., allTables = NULL, test = FALSE)

Arguments

channel

connection object as returned by odbcConnect

graph

an object of class 'toagraph' referencing graph tables in Aster database.

v

a SQL SELECT that returns key values or a list of key values (corresponding to the vertex.names attribute) of the vertices to include in the graph. When not NULL this guarentees that no other vertices or edges between other vertices are included in the resulting network.

vertexWhere

optionally, a SQL WHERE clause to subset vertex table. When not NULL it overrides vertexWhere condition from the graph.

edgeWhere

optionally, a SQL WHERE clause to subset edge table. When not NULL it overrides edgeWhere condition from the graph.

...

Other arguments passed on to ggnet2 visualization function.

allTables

pre-built information about existing tables.

test

logical: if TRUE show what would be done, only (similar to parameter test in RODBC functions: sqlQuery and sqlSave).

Value

a ggplot object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
if(interactive()) {
# initialize connection to Lahman baseball database in Aster 
conn = odbcDriverConnect(connection="driver={Aster ODBC Driver};
                         server=<dbhost>;port=2406;database=<dbname>;uid=<user>;pwd=<pw>")

policeGraphUn = toaGraph("dallaspolice_officer_vertices", "dallaspolice_officer_edges_un", 
                         directed = FALSE, key = "officer", 
                         source = "officer1", target = "officer2", 
                         vertexAttrnames = c("offense_count"), edgeAttrnames = c("weight"))

# visualize the whole graph                         
showGraph(conn, policeGraphUn, node.label = "vertex.names", node.size="offense_count")

# visualize subgraph using both vertex and edge filters
showGraph(conn, policeGraphUn, 
          vertexWhere = "officer ~ '[A-Z ].*'", edgeWhere = "weight > 0.10", 
          node.label = "vertex.names", node.size="offense_count")

}

teradata-aster-field/toaster documentation built on May 31, 2019, 8:36 a.m.