Introduction

If you've completed the htn tutorial, you've created a network, graphed it, and found a community that you are interested in exploring further. But how do you get the data out of the graph? Which documents are part of your chosen community?

In this tutorial, we'll cover adding and extracting data from a docNetwork object so that you can do more with your graphs. To begin, we'll create our docNetwork object and graph it (in case you haven't done the htn tutorial).

library(tei2r)
library(htn)
library(igraph)
dl = buildDocList(directory = system.file('extdata/natlaw/', package='tei2r'), indexFile=system.file('extdata/natlaw/index.csv', package='tei2r'))
dnet = buildNetwork(dl, view=T)
drawGraph(dnet@graph, comms=dnet@communities)

Now let's find out which documents are in our chosen community. We can extract the TCP numbers for the documents pretty easily by running:

results = extractData(dnet = dnet, comms=dnet@communities, file="", sub=T, by=2)
results


michaelgavin/htn documentation built on May 22, 2019, 9:50 p.m.