examples.Rmd
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.
The package only consists of one dataset and two functions:
connect
to build a graph by connecting variables.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 |
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.