previous.authors.graph: Create a graph from conversation data

Description Usage Arguments Value Examples

Description

Create a graph from conversation data, in which ties are drawn between authors and the authors that communicated within a given distance (lookback) before them.

Usage

1
2
previous.authors.graph(conversation, author, order.nr, lookback = 1,
  direction = "directed.up", once.per.conversation = F)

Arguments

conversation.id

A vector representing the conversation authors were engaged in (e.g. a thread, meeting)

author

A vector with unique author names/ids

order.nr

Optional. A vector representing the order in which authors communicated within a conversation.

lookback

The number of previous author with whom a tie with an author should be drawn

direction

A character string, indicating the direction of the ties. If 'undirected', ties between authors go both ways. If 'directed.up', ties are directed from author to previous authors (only if order is given). if 'directed.down', ties are directed from author to later authors.

once.per.conversation

Logical. If TRUE, max one tie between two unique authors will be counted per conversation, even if an author communicated within the given distance multiple times within the conversation.

Value

A graph object in the igraph format

Examples

1
2
3
4
5
6
7
8
9
d = data.frame(conversation=c(1,1,1,1,1,1,2,2,2,2),
             author=c('Alice','Bob','Alice','Dave','Bob','Bob','Alice','Bob','Alice','Bob'),
              order.nr=c(1,2,3,4,5,6,1,2,3,4))
g = previous.authors.graph(d$conversation, d$author, d$order.nr, lookback=1) # how many times did author.X communicate directly after author.Y?
plot(g, edge.label=E(g)$weight, vertex.size=V(g)$n.documents*25)
g = previous.authors.graph(d$conversation, d$author, d$order.nr, lookback=1, once.per.conversation=TRUE) # in how many conversations did author.X communicate directly after author.Y?
plot(g, edge.label=E(g)$weight, vertex.size=V(g)$n.documents*25)
g = previous.authors.graph(d$conversation, d$author, d$order.nr, lookback=2) # how many times did author.X communicate within two messages after author.Y?
plot(g, edge.label=E(g)$weight, vertex.size=V(g)$n.documents*25)

kasperwelbers/network-tools documentation built on May 20, 2019, 7:38 a.m.