net_con: Connect

Description Usage Arguments Details Value Examples

Description

Create network from webhoser data.

Usage

1
net_con(data, from, to = NULL, callback = NULL)

Arguments

data

The data, as returned by wh_collect.

from, to

Columns to build network.

callback

Callback to apply to edges, a data.frame with columns source, target, n (number of occurences).

Details

The returned nodes and edges form an undirected graph.

Value

A list of length 2 containing data.frames:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
data("webhoser")

# co-mentions
graph <- webhoser %>%
  net_con(entities.persons)

# unpack
c(nodes, edges) %<-% graph

# visualise
webhoser %>%
  net_con(entities.persons, entities.locations) %>% 
  net_vis()
  
# callback
cb <- function(x){
  dplyr::filter(x, n > 3)
}

webhoser %>%
  net_con(
    entities.persons, 
    entities.locations, 
    callback = cb
  ) %>% 
  net_vis()

JohnCoene/nethoser documentation built on June 13, 2019, 8:33 a.m.