Data

This vignette uses a dataset of 272 news and blog articles about the R programming language but you can collect your own data using the webhoser package which is an R wrapper to the webhoser.io API.

library(webhoser)

data("webhoser")

Basics

The package only consists of one dataset and two functions:

  1. connect to build a graph by connecting variables.
  2. visualise a convenience function which uses sigmajs to visualise the graph.

The connect function returns a list of nodes and edges.

You can unpack the graph with the %<-% assignment exported from the zeallot package.

name n
adelaide 3
afghanistan 2
afi silver theatre 1
africa 9
alfafile 3
america 8
source target n
adelaide brisbane 1
adelaide melbourne 1
adelaide sydney 1
afghanistan capitol hill 1
afghanistan washington 1
afi silver theatre d.c. 1

Co-mentions

We can build graphs of co-mentions by only passing one variable to the connect function. Below we plot co-mentions of personas in articles; each nodes is a person, they are connected by an edge when they are both mentioned in at least one article.

Graph

Below we connect sites to the location they mention in articles.

Callback

You can pass a callback function to net_con.