Create network from webhoser data.

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).

Value

A list of length 2 containing data.frames:

  • nodes: Name of entity and number of occurences.

  • edges: The source, target, and number of edges.

Details

The returned nodes and edges form an undirected graph.

Examples

data("webhoser") # co-mentions graph <- webhoser %>% net_con(entities.persons)
#> Building co-mention graph
# 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()